Invoking the Lambda function asynchronously with AWS API Gateway, you need to use an Integration Type of Lambda Integration, make sure that the Use Lambda Proxy Integration option is not checked by setting the Lambda Integration proxy as false via CDK, and add a header mapping in the Integration Request (X-Amz-Invocation-Type: 'Event').
- Asynchronous invocation
- Set up asynchronous invocation of the backend Lambda function
- Amazon API Gateway API request and response data mapping reference
- How can I invoke a Lambda function asynchronously from my Amazon API Gateway API?
The cdk.json file tells the CDK Toolkit how to execute your app.
npm installinstall projects dependenciesnpm run buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit testscdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation templatecdk bootstrapdeployment of AWS CloudFormation template to a specific AWS environment (account and region)cdk destroydestroy this stack from your default AWS account/region
-
Install all the dependencies, bootstrap your project, and synthesized CloudFormation template.
# Without passing "profile" parameter dev@dev:~:aws-cdk-samples/api-gateway/api-gateway-async-lambda$ make init # With "profile" parameter dev@dev:~:aws-cdk-samples/api-gateway/api-gateway-async-lambda$ make init profile=[profile_name]
-
Deploy the project.
# Without passing "profile" parameter dev@dev:~:aws-cdk-samples/api-gateway/api-gateway-async-lambda$ make deploy # With "profile" parameter dev@dev:~:aws-cdk-samples/api-gateway/api-gateway-async-lambda$ make deploy profile=[profile_name]
