The goal of this document is submitting a job to AWS Batch and confirming the result in CloudWatch Logs.
Since I've worked on ap-northeast-1
region, The following examples includes this region name.
import contextlib | |
import OpenSSL.crypto | |
import os | |
import requests | |
import ssl | |
import tempfile | |
@contextlib.contextmanager | |
def pfx_to_pem(pfx_path, pfx_password): | |
''' Decrypts the .pfx file to be used with requests. ''' |
The goal of this document is submitting a job to AWS Batch and confirming the result in CloudWatch Logs.
Since I've worked on ap-northeast-1
region, The following examples includes this region name.
# echo '{}' > event.json; mkdir -p libs; pip install attrs envattrs -t libs; \ | |
# export YOUR_PREFIX_SLACK_CHANNEL=your_project-staging; \ | |
# export YOUR_PREFIX_S3_BUCKET=pyconapac-bucket; \ | |
# export YOUR_PREFIX_THRESHOLD=50; \ | |
# python-lambda-local -l libs/ -f handler -t 5 lambda_pyconapac.py event.json | |
from typing import Dict | |
import attr | |
import envattrs |
# -*- coding: utf-8 -*- | |
from flask import Flask, request, render_template, current_app | |
from flask_wtf import Form | |
from wtforms.validators import DataRequired | |
from wtforms import SelectField, SelectMultipleField, SubmitField | |
app = Flask(__name__) |
# coding:utf-8 | |
from elasticsearch import Elasticsearch | |
import json | |
# Define config | |
host = "127.0.0.1" | |
port = 9200 | |
timeout = 1000 | |
index = "index" |
FROM alpine:3.7 | |
ENV AWSCLI_VERSION "1.14.10" | |
RUN apk add --update \ | |
python \ | |
python-dev \ | |
py-pip \ | |
build-base \ | |
&& pip install awscli==$AWSCLI_VERSION --upgrade --user \ |
# Name: ansible-aws-inventory-worker.yml | |
# Description: this is the worker file that called the main file (ansible-aws-inventory-main.yml) to to create an inventory of all the | |
# specific aws resources. This file, the worker file and the ansible inventory file must be placed in the same folder | |
# Prerequisites: | |
# - the worker file (ansible-aws-inventory-worker.yml) and the ansible hosts file must be present in the same folder as this file (ansible-aws-inventory-main.yml) | |
# - this script requires read access to all resources it will be querying. An AWS IAM user account must be created with the necessary permissions and with access keys enabled. | |
# At a minimum, to query all the resources mentioned above, the following permissions are required | |
# - AmazonVPCReadOnlyAccess | |
# - AmazonEC2ReadOnlyAccess | |
# - ElasticLoadBalancingReadOnly |
--- | |
# Name: ansible-aws-inventory-main.yml | |
# Description: this is the main file that calls the worker file (ansible-aws-inventory-worker.yml) to create an inventory of all the | |
# specific aws resources. | |
# Below are the resources that will be inventoried | |
# - vpc | |
# - subnet | |
# - igw | |
# - cgw | |
# - vgw |