I need to upload a file to S3 with postman for testing. I have a generated presigned URL from S3.
But I don't know how to configure postman correctly for doing this PUT request to my generated presigned URL.
The response on postman with malformed headers is:
<Code>SignatureDoesNotMatch</Code> <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
the params for the presigned request:
const params = {
Bucket: 'ss-files-dev',
Key: 'dansero.jpg',
ContentType: 'image/jpeg',
Expires: 100
};
I get the URL, then enter it in postman, with PUT request, but the headers are not complete? 1. if I add content-type on header, there is no response from server 2. in body for the request Im attaching file as "binary"
How to do my PUT request from postman?, thanks
AWS S3 provides different ways to upload your files to an S3 bucket. One of the ways to upload your file to S3 storage is using a pre-signed URL. The following steps are used to upload a file in the S3 bucket using a pre-signed URL. Create and API which accept the filename of the file to be uploaded to the S3.
Navigate to the S3 console, and open the S3 bucket created by the deployment. In the bucket, you see the JPG file uploaded via Postman.
You can use the AWS SDK to generate a presigned URL that you or anyone that you give the URL to can use to upload an object to Amazon S3. When you use the URL to upload an object, Amazon S3 creates the object in the specified bucket.
You can generate a presigned URL programmatically using the AWS SDKs for .NET, Java, Ruby, JavaScript, PHP, and Python. You can use the AWS SDK to generate a presigned URL that you or anyone that you give the URL to can use to upload an object to Amazon S3.
For me, Postman added hidden headers. If I remove the Content-Type header, the Put worked as expected.
Make sure about the following things:
1-The file name equal and same as the key when you get the signed URL.
2-Get the signed URL for putObject by passing the right parameter to getSignedUrl.
For put request not needs to set any additional headers.
I was able to get this working in Postman using a POST request with “form-data” input. I put all the details in this stack overflow post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With