我在 aws lambda 中使用 boto3 来感染位于法兰克福地区的 S3 中的对象。
v4 是必要的。否则将返回以下错误
"errorMessage": "An error occurred (InvalidRequest) when calling
the GetObject operation: The authorization mechanism you have
provided is not supported. Please use AWS4-HMAC-SHA256."
配置signature_version的实现方法http://boto3.readthedocs.org/en/latest/guide/configuration.html
但由于我使用的是 AWS lambda,因此我无权访问底层配置文件
我的 AWS lambda 函数的代码
from __future__ import print_function
import boto3
def lambda_handler (event, context):
input_file_bucket = event["Records"][0]["s3"]["bucket"]["name"]
input_file_key = event["Records"][0]["s3"]["object"]["key"]
input_file_name = input_file_bucket+"/"+input_file_key
s3=boto3.resource("s3")
obj = s3.Object(bucket_name=input_file_bucket, key=input_file_key)
response = obj.get()
return event #echo first key valuesdf
是否可以在此代码中配置 signature_version ?以会话为例。或者有什么解决方法吗?