1 Answer
- Newest
- Most votes
- Most comments
0
The issue is the fact that you attached the function to the VPC. When your function uses default networking, it has access to the public network (including all AWS services' APIs), but not to your private VPC resources. When you attach it to the VPC, your function has access to your VPC resources, but not to the public internet. To resolve that, you need to create either VPC Endpoint to the AWS services you want to access (EC2 in your case) or a NAT Gateway for any other destination.
Relevant content
- asked 3 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 5 years ago
