Grumping about the NAT gateway cost for allowing a lambda function attached to a VPC access to internet I found some suggestion about deploying the lambda in a public subnet instead of a private and attaching an EIP to the ENI that gets created by the Lambda. (I have an IGW attached to the VPC as well).
I followed this post: https://mcmap.net/q/216019/-why-can-39-t-an-aws-lambda-function-inside-a-public-subnet-in-a-vpc-connect-to-the-internet
This works! My lambda running in a public subnet gets access to internet.
However, I've read in a lot of places that "this shouldn't be possible", or "the only way to give internet access to a lambda is via a NAT-gateway/instance." or "If you do it like that, it wont scale properly".
Is this just a bad idea? My lambda needs access to both internet and resources in the VPC (rds in private subnet for instance)
The bad news: traffic out of the Lambda will be charged at $0.09 per GB (for US regions), or twice the data transfer cost of a NAT Gateway.
Could you clarify about this? I do not see any resources pointing out how Data Transfers from EIP would charge more than the NAT Gateway? The NAT Gateway charges $0.045 per GB for processing, but should still charge $0.09 per GB if sending data out to internet. In this case, the NAT gateway should always be more expensive from my understanding. – Viator