aws ラムダで 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 ラムダを使用しているため、基になる構成プロファイルにアクセスできません。
私のAWSラムダ関数のコード
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 を構成することは可能ですか? たとえば、セッションを使用します。または、これに関する回避策はありますか?