Configure an AWS Gateway in front of a Lambda function.
Project description
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:
- Read from environment.
- Read from
.env
file in current folder. - Read from flat file named via
--config-file
CLI param. - Read from
lgw.settings.defaults()
Defaults are configured in lgw.settings
.
Related Task(s) | Key | Description | Default |
---|---|---|---|
|
AWS_REGION |
AWS region. | us-east-1 |
|
AWS_API_NAME |
Name for the created API gateway. | N/A |
|
AWS_API_DESCRIPTION |
Description of the created API gateway. | N/A |
|
AWS_API_RESOURCE_PATH |
Resource path for the API. By default it's a greedy path to proxy all requests. | {proxy+} |
|
AWS_API_DEPLOY_STAGE |
Name for the stage that the API gets deployed to. E.g. "production" | N/A |
|
AWS_API_BINARY_TYPES |
Listing of binary media types to configure the gateway as handling. Example: image/jpeg,image/png | N/A |
|
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 |
|
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 |
|
AWS_API_DOMAIN_NAME |
A domain name configured in Route 53 that the API gateway can be mapped to. | N/A |
|
AWS_API_BASE_PATH |
Base path mapping to connect the domain name's CF distribution to the gateway. | (none) |
|
AWS_API_DOMAIN_WAIT_UNTIL_AVAILABLE |
Waits until the custom domain name has been created. | true, set to undefined to disable. |
|
AWS_ACM_CERTIFICATE_ARN |
ARN of an HTTPS certificate to use for securing API requests. | N/A |
|
AWS_LAMBDA_NAME |
Name for the created Lambda. | N/A |
|
AWS_LAMBDA_DESCRIPTION |
Description for the created Lambda | N/A |
|
AWS_LAMBDA_HANDLER |
Name of the handler function. e.g. "module.function" | N/A |
|
AWS_LAMBDA_RUNTIME |
Lambda runtime environment. | N/A |
|
AWS_LAMBDA_CONNECTION_TIMEOUT |
Connection timeout in seconds. | 30 |
|
AWS_LAMBDA_MEMORY_SIZE |
Amount of memory to allocate to the Lambda. | 3000 |
|
AWS_LAMBDA_ARCHIVE_BUCKET |
S3 bucket to store lambda if zip file exceeds maximum upload size. | N/A |
|
AWS_LAMBDA_ARCHIVE_KEY |
Key of the lambda archive in the configured bucket. | N/A |
|
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 |
|
AWS_LAMBDA_VPC_SUBNETS |
List of subnets that the Lambda should run in. Format: "subnetA,subnetB,subnetC,... | N/A |
|
AWS_LAMBDA_VPC_SECURITY_GROUPS |
List of security groups that control the Lambda's access. Format: "secgrpA,secgrpB,secgrpC,..." | N/A |
|
AWS_LAMBDA_ENVIRONMENT |
Variables to inject into the Lambda's environment. Format: "varA=valA;varB=valB;..." | N/A |
|
AWS_LAMBDA_TAGS |
List of tags to categorize this Lambda. Format: "tagA=valA;tagB=valB;..." | N/A |
|
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. | . |
|
AWS_LAMBDA_ARCHIVE_BUNDLE_DIR |
Destination directory to write Lambda archive zipfile. | ./build |
|
AWS_LAMBDA_ARCHIVE_BUNDLE_NAME |
Filename of Lambda archive zipfile. | lambda-bundle.zip |
|
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 |
|
AWS_LAMBDA_ARCHIVE_ADDL_PACKAGES |
List of yum packages to install in the Docker image. Format: "packageA,packageB,packageC,..." |
Default installed by this script:
|
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
Release history Release notifications | RSS feed
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.3.tar.gz
(19.6 kB
view hashes)
Built Distribution
lgw-1.2.3-py3-none-any.whl
(20.7 kB
view hashes)