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 install
install projects dependenciesnpm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation templatecdk bootstrap
deployment of AWS CloudFormation template to a specific AWS environment (account and region)cdk destroy
destroy 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]