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. N/A
  • 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.2.8.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

lgw-1.2.8-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lgw-1.2.8.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.0.0

File hashes

Hashes for lgw-1.2.8.tar.gz
Algorithm Hash digest
SHA256 853baddfaf4b0be135b439994567593b46e931c9caf52f0e61cdb98dff3784cd
MD5 0b3f2328edbd446183cafdb7e8eabd81
BLAKE2b-256 4cc13ffd23e3f8fa27f3ad56dd6e4dc4bd45c9d6a7f53eea504b98889b21fbcc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lgw-1.2.8-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/24.0.0

File hashes

Hashes for lgw-1.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5700499529b4d20e3966e91838f4fbb5a282bd7fd3ac79fcc2b67a3c70324a48
MD5 e94a4d4b34c51e7b749eb696ddd9dad9
BLAKE2b-256 a30c2033c03c058a8dd67a28672cafa2c3f5045aa407a354c8cb732288fed6be

See more details on using hashes here.

Supported by

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