S3 generate_presigned_url is not working with md5 hash
See original GitHub issueThe pre-signed url is not working with md5 hash. Normally when put
params = {'Bucket': bucket_name, 'Key': key}
url = s3_client.generate_presigned_url('put_object',
Params=params,
ExpiresIn=3600)
it works.
But when put any other put_object parameter like ACL
md5
etc it throws
params = {'Bucket': bucket_name, 'Key': key,
'ACL': 'public-read', 'ContentMD5': '1cx12....'}
url = s3_client.generate_presigned_url('put_object',
Params=params,
ExpiresIn=3600)
Error><Code>SignatureDoesNotMatch</Code><Message>
The request signature we calculated does not match the
signature you provided. Check your key and signing method
If trying put header like Content-MD5
in put request it throws Headers not signed
.
My S3 client is like
s3 = boto3.client('s3',
region_name=app.config['AWS_REGION'],
aws_access_key_id=app.config['AWS_ACCESS_KEY_ID'],
config=Config(signature_version='s3v4'),
aws_secret_access_key=app.config['AWS_SECRET_ACCESS_KEY']
)
I am using boto3==1.4.1
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Java AWS s3: How to set and upload content with Md5 pre ...
I was able to resolve it by adding following piece of code: byte[] resultByte = DigestUtils.md5(/*byte array*/); String streamMD5 = new ...
Read more >Creating Pre-Signed URLs for Amazon S3 Buckets
Create presigned URLS to Amazon S3 buckets using this AWS SDK for Go code example. ... and generates an MD5 checksum that is...
Read more >aws/aws-sdk-go - Gitter
I'm getting the following error while creating policy by CreatePolicy method: Error MalformedPolicyDocument: Resource vendor must be fully qualified and cannot ...
Read more >Securing your Amazon AWS S3 presigned URLs, tips and tricks
This is the result of my experience with S3 buckets, not an absolute truth. ... a presigned URL that checks for the file's...
Read more >AmazonS3 (AWS Java SDK for Amazon S3 1.11.403 API)
Note: Do not directly implement this interface, new methods are added to ... Callers can use this method to control which AWS region...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JordonPhillips thanks a lot, it is working. I am posting the working example for future reference.
Closing the issue
Examples of both POST and PUT methods:
PUT:
POST: