danish
danish

Reputation: 125

AWS Lambda Function Timeout on Connecting To RDS Database through RDS Proxy

I'm trying to test AWS RDS proxy so I created a lambda function and done all steps that are present in this official link

https://aws.amazon.com/blogs/compute/using-amazon-rds-proxy-with-aws-lambda

When I execute the lambda function, it times out with no errors it seems like the error might be on connecting to db with rds proxy because when I run the lambda function again without proxy, it works just fine.

I initially thought that it might be a security group issue, so I edit the security group of RDS Proxy and update inbound and allow 0.0.0.0 (outbound was already 0.0.0.0).

I used defaut VPC in RDS Database and RDS Proxy. The endpoint of RDS database is public.

Upvotes: 8

Views: 2309

Answers (2)

Mayeed
Mayeed

Reputation: 800

Late answer.. thought these might help others.

  1. You have to keep your lambdas inside the same VPC and subnets to access RDS proxy.

  2. In any case if you want to access third party web api from your lambda, you have make the lambda subnets private (no Internet Gateway in route table) and assign a NAT gateway which is tied with a public subnet.

  3. If you are accessing other AWS services which are out of VPC like S3, Secret Manager etc. then you have to create VPC endpoints for those services in your VPC.

Upvotes: 1

Humayl
Humayl

Reputation: 31

Since RDS proxy is not available outside the VPC. Configure your lambda function to run inside the VPC. The following link will help:

https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html

Upvotes: 2

Related Questions