Skill 1.2.1
Grant Lambda functions access to private resources in VPCs.
Key Concepts
You attach a function to a VPC by choosing subnets and security groups; Lambda creates elastic network interfaces (Hyperplane ENIs) in those subnets, and the execution role needs permissions to manage them (the AWSLambdaVPCAccessExecutionRole managed policy). The target resource's security group must allow traffic from the function's security group.
A VPC-attached function no longer has internet access by default. To call public APIs or AWS services, it needs a route through a NAT gateway in a public subnet, or VPC endpoints for AWS services such as S3, DynamoDB and Secrets Manager. Giving the function a public IP does not work. To avoid exhausting database connections, use RDS Proxy.