patternMinor
Placing an AWS Lambda in a public subnet
Viewed 0 times
placingpublicawssubnetlambda
Problem
Is it possible to place an aws lambda in a public subnet and thus avoid paying for
The docs state the following
If your Lambda function needs Internet access, do not attach it to a public subnet or to a private subnet without Internet access. Instead, attach it only to private subnets with Internet access through a NAT instance or an Amazon VPC NAT gateway.
But do not explain why we can not attach the lambda to a public subnet.
NAT?The docs state the following
If your Lambda function needs Internet access, do not attach it to a public subnet or to a private subnet without Internet access. Instead, attach it only to private subnets with Internet access through a NAT instance or an Amazon VPC NAT gateway.
But do not explain why we can not attach the lambda to a public subnet.
Solution
No, it's not possible to place an AWS Lambda in a public subnet and thus avoid paying for NAT. Lambda functions cannot have public IPs so they cannot route to the internet without a NAT (gateway or instance).
Put them in a private subnet, ensure the private subnet's default route is a NAT in a public subnet, that the NAT has a public IP, and that the VPC has an IGW.
For more, see this Stack Overflow question.
Put them in a private subnet, ensure the private subnet's default route is a NAT in a public subnet, that the NAT has a public IP, and that the VPC has an IGW.
For more, see this Stack Overflow question.
Context
StackExchange DevOps Q#4944, answer score: 5
Revisions (0)
No revisions yet.