0

I am using an existing python 2.7 script that imports boto. I got the error Requests specifying Server Side Encryption with AWS KMS managed keys require AWS Signature Version 4 so I am currently trying to add this using Using boto for AWS S3 Buckets for Signature V4 as a resource.

Some answers there advised adding this code:

if not boto.config.get('s3', 'use-sigv4'):
    boto.config.add_section('s3')
    boto.config.set('s3', 'use-sigv4', 'True')

From reading the linked docs, it seems I should add this to the config.py from botocore. I did this, but I still get the error.There's also this snippet in the docs: Specify the following in the boto default config file:

[s3] use-sigv4 = True

I'm not clear on where to add this.

Or, it seems I could set s3 to use sigv4 by default in the cli by using:

aws configure set default.s3.signature_version s3v4

I don't have the Amazon CLI installed and am not familiar with it, so I'm wondering if there's another way I can set it to be the default version.

miike3459
  • 1,431
  • 2
  • 16
  • 32
topplethepat
  • 531
  • 6
  • 23
  • Is this boto or boto3? – jarmod Oct 12 '18 at 21:48
  • @jarmod it's boto – topplethepat Oct 12 '18 at 21:53
  • 1
    Add that use-sigv4 config setup just before you create an S3 connection object in your code. You'll probably also have to add boto.config.set('s3', 'host', 's3.eu-central-1.amazonaws.com') or whichever region is appropriate. – jarmod Oct 12 '18 at 23:29
  • do you mean here:s3 = boto.connect_s3( access_key, secret_key, #use-sigv4 = True, calling_format = boto.s3.connection.OrdinaryCallingFormat(), ) – topplethepat Oct 12 '18 at 23:37
  • 1
    Add the S3 section to boto.config, as you've shown (under "advised adding this code"). Add the aforementioned host config, then create your S3 connection. I would keep it simple e.g. c = boto.connect_s3(access_key, secret_key). – jarmod Oct 13 '18 at 00:03

0 Answers0