Lambda function should have access to VPC resources in configuration



Configure your Amazon Lambda Function to have access to VPC-only resources.


By default, Amazon Lambda functions run in a secure VPC with access to any AWS service and the internet. Selecting which resources have access secures the connections within your private VPC.


From the console

Follow the Configuring VPC access (console) docs to configure VPC access for an existing function.

From the command line

  1. Run update-function-configuration with your Amazon Lambda function name and VPC configuration. Set network connectivity to AWS resources within the configured VPC.

       aws lambda update-function-configuration
           --function-name your-lambda-function-name
           --vpc-config SubnetIds="subnet-ab12cd34","subnet-12345678",SecurityGroupIds="id-0abcd1234abcd5678"