Problem with copy_part_from_key API on S3 SigV4 only regions
KeyboardNerd opened this issue · comments
Hello,
For AWS S3 buckets, when copying a key by parts with the start and end positions, the request will fail with 403
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signatureyou provided. Check your key and signing method.</Message><AWSAccessKeyId>
This is only reproducible in regions with SigV4 only. If other type of region is chosen, for example, US-East (N. Virginia), the problem can't be reproduced.
Reproduce:
-
Choose an S3 region with only SigV4 turned on, for example
EU (Frankfurt), s3.eu-central-1.amazonaws.com
-
Run the following code with <*> set properly.
from boto.s3.connection import S3Connection
secret = "<Your Secret>"
access = "<Your Access ID>"
bucket_name = "<Your Bucket Name>"
host = "<Your Host Name>"
source_file_name = "<Your source file>"
new_file_name = "<Your new file>"
conn = S3Connection(access, secret, host=host)
bucket = conn.get_bucket(bucket_name)
mpu = bucket.initiate_multipart_upload(new_file_name)
mpu.copy_part_from_key(bucket_name, source_file_name, 1, 0, 15)
mpu.complete_upload()
Expected: No output, and the new file exists and contains the first 16 bytes of the original file.
Actual: The 403 error shown above, and the new file doesn't exist.
it turns out to be the same issue: #3749