不确定什么变化了
我正在设置一个lambda函数,该函数从S3中摘下文件对象。我一直遇到超时错误,经过调查,似乎是我称为s3.get_object(...(的地方,其中s3 = boto3.client('s3'(
看来所有涉及boto3的代码都有问题,因为AWS Secrets Manager(使用Boto3.session(也挂起。
我想知道这是否是凭证问题,但是认为这不太可能是因为它从lambda功能中运行。
s3 = boto3.client('s3')
def handler(event, context):
"""
This function fetches content from MySQL RDS instance
"""
print("Received event: " + json.dumps(event, indent=2))
body_json = json.loads(event['Records'][0]['body'])
bucket = body_json["Records"][0]["s3"]["bucket"]["name"]
key = urllib.parse.unquote_plus(body_json["Records"][0]["s3"]['object']['key'], encoding='utf-8')
#Everything runs up to this line, and hangs from here on out
response = s3.get_object(Bucket=bucket, Key=key)
我认为最奇怪的是,关于我的代码的所有内容都可以正常工作,直到几个小时前,我对S3没有任何问题。由于我没有更改任何lambda代码...
您可能需要允许使用S3的Lambda权限。
这可能会有所帮助