botocore.exceptions.ClientError An error occurred (SignatureDoesNotMatch) when calling the GetObject operation

bod*_*743 5 python ssl amazon-s3 amazon-web-services boto3

While running the following code:

import boto3
BUCKET = 'bwd-plfb'

s3 = boto3.client('s3',use_ssl = False)

resp = s3.list_objects_v2(Bucket = BUCKET )

s3.download_file(BUCKET,'20171018/OK/OK_All.zip','test.zip')
Run Code Online (Sandbox Code Playgroud)

I'm getting the following error:

   botocore.exceptions.ClientError: An error occurred 
   (SignatureDoesNotMatch) when calling the GetObject operation: The request 
   signature we calculated does not match the signature you provided. Check 
   your key and signing method.
Run Code Online (Sandbox Code Playgroud)

What I've tried so far:

  1. Double checking Access key ID and Secret access key configured in aws cli (Running aws configure in command prompt) - They're correct.
  2. Trying to list bucket objects using boto3 - It worked successfully. The problem seems to be occuring when trying to download files.
  3. Using a chrome plugin to browse bucket contents and download files: chrome plugin It works successfully.

The interesting thing is downloading works for some files but not all. I downloaded a file which previously worked before 20 times in a row to see if the error was intermittent. It worked all 20 times. I did the same thing for a file which had not previously worked and it did not download any of the 20 times.

I saw some other posts on stackoverflow saying the api key & access key maybe incorrect. However, I don't believe that to be the case if I was able to list objects and download files (one's which did & did not work through boto3) using the Chrome S3 plugin.

有没有人对这里可能出现的问题有任何建议?

谢谢

Rya*_*der 9

当您为 s3 使用错误/无效的密钥时会发生此错误