aws s3 cp {bucket} ./ - SignatureDoesNotMatch error

0

Regarding downloading files using aws cli, I got SignatureDoesNotMatch error.

The error message is the following. aws s3 cp s3://{}/ai-oven-woosong/video_20220527_breadroll_ss6hmdf_t1_#5.mp4 ./ download failed: s3://{}/video_20220527_breadroll_ss6hmdf_t1_#5.mp4 to ./video_20220527_breadroll_ss6hmdf_t1_#5.mp4 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.

But there is no problem about other files. aws s3 cp s3://{****}/rawdata_20225026_breadroll_ss6mdfrc-t1_#6.csv ./ download: s3://ai-oven-woosong/rawdata_20225026_breadroll_ss6mdfrc-t1_#6.csv to ./rawdata_20225026_breadroll_ss6mdfrc-t1_#6.csv

There is no problem with other files except extension mp4. downloading is available. I changed the extention mp4 to txt but it is not working.

I have configured access id and secret key on my environment. The secret key does not include the characters of -, +, /, %.

If the reason is SignatureDoesNotMatch error, I could not download all files at all. But it is available other files(extension csv and txt) except extension mp4 file.

Please let me know how to resolve it.

Regards, Heedong

asked 2 years ago350 views
2 Answers
0

Hello Heedong,

The SignatureDoesNotMatch error commonly occurs when there is a mismatch between the request signature calculated by AWS and the signature provided in the request. This can happen if the access key or secret key is incorrect or if the endpoint being used is incorrect. Based on the error message you have shared, it seems like there could be an issue with the filename that contains special characters like #. The # character is a reserved character in URLs that represents a fragment identifier. This could be causing the signature calculated by AWS to be different from the signature provided in the request.

To resolve this issue, you can try URL encoding the filename before using it in the AWS CLI command by replacing the special characters with their corresponding URL-encoded values.

For example, # can be replaced with %23. You can use the following command to encode the filename:

  • export FILENAME="video_20220527_breadroll_ss6hmdf_t1_#5.mp4"
  • export ENCODED_FILENAME=$(python -c "import urllib; print urllib.quote('''$FILENAME''', safe='')")

Then, you can use the encoded filename in your AWS CLI command like this:

  • aws s3 cp s3://{}/ai-oven-woosong/$ENCODED_FILENAME ./

Alternatively, you can rename the file to avoid using special characters like # in the filename.

Reference:

  1. AWS S3 Developer Guide - Accessing Amazon S3 using the AWS SDKs: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-character-encoding
  2. AWS CLI documentation - cp command: https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html
AWS
Wethu_M
answered 10 months ago
0

With your detailed explanation, I understood exactly what caused the problem. Your good answer helped me a lot. Thank you.

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions