-c create
-x extract
-v verbose mode
-f filename
-t view content of archive file.
-j bzip2
-z gzip
| { | |
| "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": { |
| 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, |
| # 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) |
| #!/bin/sh | |
| # | |
| # Delete a VPC and its dependencies | |
| if [ -z "$1" ] then | |
| echo "usage: $0 <vpcid>" | |
| exit 64 | |
| fi | |
| vpcid="$1" |
| """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 |
| """Helper module for logging. | |
| Example Usage: | |
| from log import get_logger, get_out_dir_of_logger | |
| LOG = get_logger(__name__) | |
| LOG.info('Logging to %s' % get_out_dir_of_logger(LOG)) | |
| """ |
| ''' | |
| This script performs efficient concatenation of files stored in S3. Given a | |
| folder, output location, and optional suffix, all files with the given suffix | |
| will be concatenated into one file stored in the output location. | |
| Concatenation is performed within S3 when possible, falling back to local | |
| operations when necessary. | |
| Run `python combineS3Files.py -h` for more info. | |
| ''' |
| # To get boto3.resource to use a profile name, one must first | |
| # setup a default session. The credentials provided during the | |
| # session setup will be subsequently used by resource(). | |
| # | |
| # See: https://github.com/boto/boto3/issues/21 | |
| # https://github.com/boto/boto3/pull/69 | |
| boto3.setup_default_session(profile_name=self.dpkg.profile_name) | |
| self.ec2 = boto3.resource('ec2', region_name=self.dpkg.region_name) | |
| filters = [{'Name': 'instance-state-name', 'Values': ['running']}] | |
| for inst in self.ec2.instances.filter(Filters=filters): |