2 Answers
- Newest
- Most votes
- Most comments
4
This is very common scenario as same applicable for all compute. As a best practice you should create Lambda within VPC so you can access RDS. To access S3 from Lambda function inside a VPC, use VPC endpoints
answered a year ago
1
You must connect the Lambda to a VPC that can communicate with the database or look at other options, such as RDS Proxy or the RDS Data API. I haven't used RDS Proxy or RDS's Data API recently, and I can't remember if they enable communication with the DB without being in the private VPC, but that is where I would look first.
answered a year ago
Thanks for the advice, I made the endpoint first and it works, perhaps in another time I can try the proxy.
Relevant content
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
And or have your Lambda function connect to a subnet with a route to a NAT gateway to provide internet connectivity so that you can reach services such as S3.
However, I do agree with Nirmal. Create VPC Endpoints. I believe a S3 gateway endpoint is free. Make sure you have a route with the preflix list applied to the subnet where your Lambda function connects
Thanks to all. I follow the advice and create the endpoint and works properly.