Lambda function should have access to VPC resources in configuration

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Description

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

Rationale

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.

Remediation

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.

    update-function-configuration.sh

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