How does a VPC-attached Lambda reach the internet and AWS services?
IntermediateConceptContainers and Serverless
Answer
Lambda creates (Hyperplane) ENIs in your subnets, shared across environments, so it can reach private resources like RDS. It then loses default internet access: public subnets do not help because Lambda ENIs have no public IP. You need a NAT gateway for internet, or VPC endpoints for AWS services like S3, DynamoDB, SQS and Secrets Manager.
Put the function in private subnets across at least two AZs.
More on Containers and Serverless
ECS vs EKS vs Fargate: what is the relationship?BeginnerWhat are ECS task definitions, tasks and services?BeginnerWhat are ECS capacity providers?IntermediateWhat is the difference between the ECS task role and the task execution role?IntermediateHow does `awsvpc` network mode work in ECS?IntermediateWhat deployment strategies does ECS support?Advanced