Amazon API Gateway (HTTP) to AWS Lambda

API Gateway → AWS Lambda

This pattern creates an Amazon API Gateway (HTTP) and an AWS Lambda function.

This pattern deploys an Amazon API Gateway (HTTP) with a default route and basic CORS configuration.
The default route is integrated with an AWS Lambda function written in Python.
The function logs the incoming API event (v2) and context object to an Amazon CloudWatch Logs log group and returns basic information about the event to the caller.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/terraform-apigw-http-api-lambda

Deploy

terraform initterraform apply --auto-approve


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

terraform destroy

Created by:

Anton Babenko

Anton Babenko

AWS Hero, Terraform influencer, maintainer of Terraform AWS Modules, creator of serverless.tf, weekly.tf, modules.tf, and some more.

Follow on LinkedIn