CDK constructs for defining an interaction between an API Gateway and a Lambda function.
Project description
aws-apigateway-lambda module
---All classes are under active development and subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
Reference Documentation: | https://docs.aws.amazon.com/solutions/latest/constructs/ |
---|
Language | Package |
---|---|
Python | aws_solutions_constructs.aws_apigateway_lambda |
Typescript | @aws-solutions-constructs/aws-apigateway-lambda |
Java | software.amazon.awsconstructs.services.apigatewaylambda |
Overview
This AWS Solutions Construct implements an Amazon API Gateway REST API connected to an AWS Lambda function pattern.
Here is a minimal deployable pattern definition:
const { ApiGatewayToLambda } = require('@aws-solutions-constructs/aws-apigateway-lambda');
new ApiGatewayToLambda(stack, 'ApiGatewayToLambdaPattern', {
lambdaFunctionProps: {
runtime: lambda.Runtime.NODEJS_10_X,
handler: 'index.handler',
code: lambda.Code.asset(`${__dirname}/lambda`)
}
});
Initializer
new ApiGatewayToLambda(scope: Construct, id: string, props: ApiGatewayToLambdaProps);
Parameters
- scope
Construct
- id
string
- props
ApiGatewayToLambdaProps
Pattern Construct Props
Name | Type | Description |
---|---|---|
existingLambdaObj? | lambda.Function |
Existing instance of Lambda Function object, if this is set then the lambdaFunctionProps is ignored. |
lambdaFunctionProps? | lambda.FunctionProps |
User provided props to override the default props for the Lambda function. |
apiGatewayProps? | api.LambdaRestApiProps |
Optional user-provided props to override the default props for the API. |
Pattern Properties
Name | Type | Description |
---|---|---|
lambdaFunction | lambda.Function |
Returns an instance of the Lambda function created by the pattern. |
restApi | api.LambdaRestApi |
Returns an instance of the API Gateway REST API created by the pattern. |
apiGatewayCloudWatchRole | iam.Role |
Returns an instance of the iam.Role created by the construct for API Gateway for CloudWatch access. |
apiGatewayLogGroup | logs.LogGroup |
Returns an instance of the LogGroup created by the construct for API Gateway access logging to CloudWatch. |
Default settings
Out of the box implementation of the Construct without any override will set the following defaults:
Amazon API Gateway
- Deploy an edge-optimized API endpoint
- Enable CloudWatch logging for API Gateway
- Configure least privilege access IAM role for API Gateway
- Set the default authorizationType for all API methods to IAM
AWS Lambda Function
- Configure least privilege access IAM role for Lambda function
- Enable reusing connections with Keep-Alive for NodeJs Lambda function
Architecture
© Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
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
Built Distribution
Hashes for aws-solutions-constructs.aws-apigateway-lambda-1.58.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94e013bb4023e436a61ea6d7d1651b6ce2e38613412c05ed35c5482e7e8bbbc7 |
|
MD5 | 432699280d72846b65cf3d8b7f9f0b6d |
|
BLAKE2b-256 | 557ae5d5462a8f130883b0cae132e929abc7a685b39df9cae91d93f9369c1799 |
Hashes for aws_solutions_constructs.aws_apigateway_lambda-1.58.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7451ff2ad5a700509b69312473bf19042b8bfef65240891d29d7ae5808334ff |
|
MD5 | 08fc8bd16bfc87b266104c4f70e85a85 |
|
BLAKE2b-256 | dca30f4f558a82f0055c5f66c6801d9accf4a13713b1ae5246cc176203b454be |