How to configure authorization mechanism inline with boto3

后端 未结 2 856
悲哀的现实
悲哀的现实 2021-02-04 06:25

I am using boto3 in aws lambda to fecth object in S3 located in Frankfurt Region.

v4 is necessary. otherwise following error will return

\"errorMessage\"         


        
2条回答
  •  清酒与你
    2021-02-04 07:05

    Instead of using the default session, try using custom session and Config from boto3.session

    import boto3
    import boto3.session
    session = boto3.session.Session(region_name='eu-central-1')
    s3client = session.client('s3', config= boto3.session.Config(signature_version='s3v4'))
    s3client.get_object(Bucket='', Key='S3-Object-Key')
    

提交回复
热议问题