Skip to main content

Configure an AWS Gateway in front of a Lambda function.

Project description

PyPi License PyPi

Lambda Gateway

Configure an AWS Gateway in front of a Lambda function.

Usage

Lambda Gateway.

Usage:
  lgw gw-deploy [--verbose] --config-file=<cfg>
  lgw gw-undeploy [--verbose] --config-file=<cfg>
  lgw domain-add [--verbose] --config-file=<cfg>
  lgw domain-remove [--verbose] --config-file=<cfg>
  lgw lambda-deploy [--verbose] --config-file=<cfg> --lambda-file=<zip>
  lgw lambda-invoke [--verbose] --lambda-name=<name> [--payload=<json>]
  lgw lambda-delete [--verbose] --lambda-name=<name>
  lgw lambda-archive [--verbose] --config-file=<cfg>

Options:
  -h --help             Show this screen.
  --version             Show version.
  --verbose             Enable DEBUG-level logging.
  --config-file=<cfg>   Override defaults with these settings.
  --lambda-file=<zip>   Path to zip file with executable lambda code.
  --lambda-name=<name>  Name of the lambda to invoke or delete.
  --payload=<json>      Path to a file of type json with data to send with the lambda invocation.

Configuration Parameters

Configuration params are read in the following order, with the first read of it overriding subsequent configs:

  1. Read from environment.
  2. Read from .env file in current folder.
  3. Read from flat file named via --config-file CLI param.
  4. Read from lgw.settings.defaults()

Defaults are configured in lgw.settings.

Related Task(s) Key Description Default
  • All
AWS_REGION AWS region. us-east-1
  • gw-deploy
  • gw-undeploy
  • domain-add
  • domain-remove
AWS_API_NAME Name for the created API gateway. N/A
  • gw-deploy
AWS_API_DESCRIPTION Description of the created API gateway. N/A
  • gw-deploy
AWS_API_RESOURCE_PATH Resource path for the API. By default it's a greedy path to proxy all requests. {proxy+}
  • gw-deploy
AWS_API_DEPLOY_STAGE Name for the stage that the API gets deployed to. E.g. "production" N/A
  • gw-deploy
AWS_API_BINARY_TYPES Listing of binary media types to configure the gateway as handling. Example: image/jpeg,image/png N/A
  • gw-deploy
AWS_API_RESPONSE_MODELS Response content-type: model mapping of the response body. Typically used for mapping binary content-types. For binary types specify: image/*=Empty application/json=Empty
  • gw-deploy
AWS_API_LAMBDA_INTEGRATION_ROLE ARN of a role that grants permission to the API gateway to invoke a lambda. Should have AmazonAPIGatewayPushToCloudWatchLogs and AWSLambdaRole managed roles as permissions, and apigateway.amazonaws.com as a trusted entity. N/A
  • domain-add
AWS_API_DOMAIN_NAME A domain name configured in Route 53 that the API gateway can be mapped to. N/A
  • domain-add
AWS_API_BASE_PATH Base path mapping to connect the domain name's CF distribution to the gateway. (none)
  • domain-add
AWS_API_DOMAIN_WAIT_UNTIL_AVAILABLE Waits until the custom domain name has been created. true, set to undefined to disable.
  • domain-add
AWS_ACM_CERTIFICATE_ARN ARN of an HTTPS certificate to use for securing API requests. N/A
  • gw-deploy
  • lambda-deploy
AWS_LAMBDA_NAME Name for the created Lambda. N/A
  • lambda-deploy
AWS_LAMBDA_DESCRIPTION Description for the created Lambda N/A
  • lambda-deploy
AWS_LAMBDA_HANDLER Name of the handler function. e.g. "module.function" N/A
  • lambda-deploy
AWS_LAMBDA_RUNTIME Lambda runtime environment. python3.7
  • lambda-deploy
AWS_LAMBDA_CONNECTION_TIMEOUT Connection timeout in seconds. 30
  • lambda-deploy
AWS_LAMBDA_MEMORY_SIZE Amount of memory to allocate to the Lambda. 3000
  • lambda-deploy
AWS_LAMBDA_ARCHIVE_BUCKET S3 bucket to store lambda if zip file exceeds maximum upload size. N/A
  • lambda-deploy
AWS_LAMBDA_ARCHIVE_KEY Key of the lambda archive in the configured bucket. N/A
  • lambda-deploy
AWS_LAMBDA_EXECUTION_ROLE_ARN ARN of a role with permissions to execute the Lambda. Should have AWSXrayWriteOnlyAccess and AWSLambdaBasicExecutionRole managed roles as permissions, and lambda.amazonaws.com as a trusted entity. N/A
  • lambda-deploy
AWS_LAMBDA_VPC_SUBNETS List of subnets that the Lambda should run in. Format: "subnetA,subnetB,subnetC,... N/A
  • lambda-deploy
AWS_LAMBDA_VPC_SECURITY_GROUPS List of security groups that control the Lambda's access. Format: "secgrpA,secgrpB,secgrpC,..." N/A
  • lambda-deploy
AWS_LAMBDA_ENVIRONMENT Variables to inject into the Lambda's environment. Format: "varA=valA;varB=valB;..." N/A
  • lambda-deploy
AWS_LAMBDA_TAGS List of tags to categorize this Lambda. Format: "tagA=valA;tagB=valB;..." N/A
  • lambda-archive
AWS_LAMBDA_ARCHIVE_CONTEXT_DIR Root directory of the project that will provide files to be copied into the Docker image. If the directory ends with a trailing slash, then the root of the context will be the contents of the directory; otherwise the leaf directory will be at the root of the context. .
  • lambda-archive
AWS_LAMBDA_ARCHIVE_BUNDLE_DIR Destination directory to write Lambda archive zipfile. ./build
  • lambda-archive
AWS_LAMBDA_ARCHIVE_BUNDLE_NAME Filename of Lambda archive zipfile. lambda-bundle.zip
  • lambda-archive
AWS_LAMBDA_ARCHIVE_ADDL_FILES List of 2-tuples of files to copy into the context directory from the local computer. Format: "srcA,desA;srcB,desB;srcC,desC;..." N/A
  • lambda-archive
AWS_LAMBDA_ARCHIVE_ADDL_PACKAGES List of yum packages to install in the Docker image. Format: "packageA,packageB,packageC,..." Default installed by this script:
  • gcc
  • openssl-devel
  • bzip2-devel
  • libffi-devel
  • python37-pip

Releasing

git flow release start x.y.z
# bump version
vi pyproject.toml lgw/version.py
git add pyproject.toml lgw/version.py
git commit -m 'bump version'
dephell deps convert
poetry publish --build
git flow release finish x.y.z

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lgw-1.1.2.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

lgw-1.1.2-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file lgw-1.1.2.tar.gz.

File metadata

  • Download URL: lgw-1.1.2.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.6 Darwin/19.4.0

File hashes

Hashes for lgw-1.1.2.tar.gz
Algorithm Hash digest
SHA256 8c6c59b9ab82491fa5df960327e48f86a034d2f443b59a03fe866f99dcc35a47
MD5 1830f8192ad256ecf964bd7bd25b5acd
BLAKE2b-256 a907e5b2f547a7fd853f8363d2b82a3cfaeeff569643a69cc7ba693ef02d238a

See more details on using hashes here.

File details

Details for the file lgw-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: lgw-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.6 Darwin/19.4.0

File hashes

Hashes for lgw-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2a4aed3850564059f7f533d76c42c90438dd5be85d60e65e471ce6394f59031
MD5 1d2f2189927a45e6c2a1e26f6b43570d
BLAKE2b-256 9b5ca86f4b70da63c777f570e57a70d8287bfb7dfb54515637d86d24ac27d4bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page