Hey everyone! I've got a question about AWS Lambda and VPCs. Is it possible for a Lambda function running inside a Virtual Private Cloud (VPC) to access the internet without using a NAT Gateway? I'm trying to connect to a private RDS instance, but I can't make it public, and I also can't use a NAT instance.
4 Answers
If the Lambda isn't in your VPC, it will automatically receive a public IP and have internet access. But once it's within a VPC, things change a bit.
Yeah, it can actually get internet access if it’s in a public subnet within your VPC. Just make sure your VPC is set up to auto-assign a public IP to the network interface!
If you're talking about accessing RDS for API requests instead of direct database access, you can set up an RDS interface VPC endpoint. This way, traffic can route locally without needing internet access.
I'm actually trying to use it for direct database access. Can those interface VPC endpoints work with a private RDS?
From what I understand, for a Lambda in a VPC, you usually need a NAT Gateway for internet access. Both 'public' and 'private' routing aren't compatible for Lambdas according to AWS guidelines.
Got it! But what if I need it only to connect to the RDS?