I have an AWS Lambda function written in Go that needs to connect to an RDS and an ElastiCache instance, both of which are in a VPC. To achieve this, I placed the Lambda function in an allowed security group and a public subnet. This setup works, and the Lambda function can connect to both RDS and ElastiCache.
Now, I need the Lambda function to make requests to the public internet, for example, https://google.com.br. What is the most cost-effective solution for enabling this?
I came across the option of using a NAT Gateway, but it seems too expensive and overly complex for just making HTTP requests.
How can I achieve internet access for my Lambda function in a cost-effective manner?
1