AWS Glue Dynamodb 连接超时错误

AWS Glue Dynamobd Connection Timed out Error

import boto3
dynamodb = boto3.resource('dynamodb', region_name="us-east-1")
table = dynamodb.Table('user_logs')
response = table.scan()

上面的 aws glue 作业脚本出现以下错误

botocore.vendored.requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='dynamodb.us-east-1.amazonaws.com', port=443): Max retries exceeded with url: / (Caused by ConnectTimeoutError(<botocore.awsrequest.AWSHTTPSConnection object at 0x7f7c58942b50>, 'Connection to dynamodb.us-east-1.amazonaws.com timed out. (connect timeout=60)'))

知道为什么会这样吗?

如果您的粘合脚本指向 VPC,那么您需要为您配置的 VPC 创建 VPC 端点。

转到 AWS VPC > 端点 > 为您的 VPC 创建 dynamo 数据库端点,然后尝试。