可能是由于在VPC内部运行时,你的Lambda访问点需要将响应写回到VPC子网中,并且由于安全组或网络ACL配置的限制而被阻止。建议检查安全组和ACL配置并确保访问点可以在VPC子网中写入。
以下是一个代码示例,你可以使用该示例代码来设置访问点的iam角色和安全组设置:
import boto3
from botocore.config import Config
client = boto3.client('accesspoint',
region_name='us-west-2',
config=
Config(
retries={
'max_attempts': 10,
'mode': 'standard'
}
))
# set up the role and security group for your access point
response = client.put_access_point_configuration(
AccountId='123456789012',
Name='example-access-point',
Configuration={
'ObjectLambdaAccessPointConfiguration':{
'TransformationConfigurations':[
# specify the IAM role and security group settings
{
'Actions':[
{
'Action':'GetObject',
'GetObject':{}
}
],
'ObjectLambdaTransformConfig':{
'AwsLambda':{
'FunctionArn':'arn:aws:lambda:us-west-2:123456789012:function:example-function'
},
'InputSchema':{},
'OutputSchema':{}
},
'ObjectLambdaAllowedFeatures':[
'GetObject'
],
'ContentTransformation':{
'AwsLambda':{
'FunctionArn':'arn:aws:lambda:us-west-2:123456789012:function:example-function'
},
'InputSchema':{},
'OutputSchema':{}
}
}
]
}
}
)
# print the response
print(response)