Unable to connect to S3 from Lambda/Python/Boto3 when VPC is enabled
问题 I have a very simple python function in a lambda which runs fine if I leave VPC disabled. import json import boto3 import botocore def lambda_handler(event, context): s3 = boto3.client('s3', 'us-east-1', config=botocore.config.Config(s3={'addressing_style':'path'})) keys = [] resp = s3.list_objects_v2(Bucket='[BUCKET_NAME]') for obj in resp['Contents']: print(obj['Key']) return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') } When VPC is enabled the S3 connection continually