From the AWS lambda documentation:
AWS Lambda runs your function code securely within a VPC by default.
What are the "default" lambda VPC settings for CIDR blocks, ingress rules, and egress rules?
If a VPC is not specified for a Lambda function, it runs in an Amazon-controlled VPC over which you have no control or visibility. The Lambda function is able to connect to the Internet, but you cannot put any other resources in that 'mysterious' VPC.
So, to answer your question:
If you wish to have more control over the VPC in which Lambda runs, you can create your own VPC (in the normal VPC console) and configure the Lambda function to run in that VPC.
Please note that, in this situation, the Lambda function receives a private IP address and does not have direct access to the Internet. If you wish the function to access the Internet, you will need to treat it like a resource in a private subnet and use a NAT Gateway to provide Internet access.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With