This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Base class for implementing Lambda handlers as classes. | |
| Used across multiple Lambda functions (included in each zip file). | |
| Add additional features here common to all your Lambdas, like logging.""" | |
| class LambdaBase(object): | |
| @classmethod | |
| def get_handler(cls, *args, **kwargs): | |
| def handler(event, context): | |
| return cls(*args, **kwargs).handle(event, context) | |
| return handler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # Delete a VPC and its dependencies | |
| if [ -z "$1" ] then | |
| echo "usage: $0 <vpcid>" | |
| exit 64 | |
| fi | |
| vpcid="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import config. | |
| # You can change the default config with `make cnf="config_special.env" build` | |
| cnf ?= config.env | |
| include $(cnf) | |
| export $(shell sed 's/=.*//' $(cnf)) | |
| # import deploy config | |
| # You can change the default deploy config with `make cnf="deploy_special.env" release` | |
| dpl ?= deploy.env | |
| include $(dpl) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cgi import FieldStorage | |
| from io import BytesIO | |
| def parse_into_field_storage(fp, ctype, clength): | |
| fs = FieldStorage( | |
| fp=fp, | |
| environ={'REQUEST_METHOD': 'POST'}, | |
| headers={ | |
| 'content-type': ctype, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "AWSTemplateFormatVersion": "2010-09-09", | |
| "Description": "AWS CloudFormation sample template that contains a single Lambda function behind an API Gateway", | |
| "Resources": { | |
| "GreetingLambda": { | |
| "Type": "AWS::Lambda::Function", | |
| "Properties": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: Sample template that contains a Lambda function behind an API GW | |
| Resources: | |
| # BEGIN: Should only need this in an empty API Gateway situation | |
| ApiGatewayCloudWatchLogsRole: | |
| Type: AWS::IAM::Role | |
| Properties: | |
| AssumeRolePolicyDocument: | |
| Version: '2012-10-17' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: "2010-09-09" | |
| Description: "Static website hosting with S3 and CloudFront" | |
| Parameters: | |
| BucketName: | |
| Type: String | |
| Default: "a-proper-bucket-name" | |
| Resources: | |
| # Create the bucket to contain the website HTML |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install Python 3 | |
| $ sudo apt-get install python3 | |
| # Install python3-virtualenv | |
| $ sudo apt-get install python3-virtualenv | |
| # You can checkout you virtualenv version | |
| $ virtualenv --version | |
| # Create you virtualenv in the folder you that want to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "iam:*", | |
| "lambda:*", | |
| "cloudformation:*", | |
| "sns:CreateTopic", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import yaml | |
| import logging.config | |
| import logging | |
| import coloredlogs | |
| def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'): | |
| """ | |
| | **@author:** Prathyush SP | |
| | Logging Setup |