Amazon API Gateway HTTP API to AWS Lambda to RDS Proxy

HTTP API → AWS Lambda → RDS proxy instance → Amazon Aurora

Create an HTTP API endpoint that calls a Lambda function to RDS Proxy.

When an HTTP POST request is sent to the Amazon API Gateway endpoint, the AWS Lambda function is invoked to issue a database query against an RDS proxy endpoint.
The lambda function retrieves a temporary token from IAM to authenticate instead of using native database credentials.
The RDS proxy will then establish a connection to the database, the lambda function will borrow this database connection for the next query/transaction.

< 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/apigw-http-api-lambda-rds-proxy-terraform

Deploy

terraform initterraform apply


Testing

See testing in the README.md file in the repo

Cleanup

1. Delete the stack: terraform destroy.
2. Confirm the stack has been deleted: terraform show

Additional resources

Created by:

Carlos Bauer

I am Technical Account Manager at AWS