Several years have passed since the last answer, but I was stuck with this for the last one or two days, so I will share my experience with everyone who can help it.
I get the error: "403: The AWS passkey code that you specified does not exist in our records" when I try to load into the s3 bucket through my pre-assigned URL.
I managed to generate a pre-assigned URL, similar to the above, using server-side code:
signed_url_dict = self.s3_client.generate_presigned_post( self.bucket_name, object_name, ExpiresIn=300
This returned a dictionary with the structure:
{ url: "https://___", fields: { key: "___", AWSAccesKeyId: "___", x-amz-security-token: "___", policy: "___", signature: "___" } }
This led to the fact that in 2019 everything was a bit different with javascript on the browser side, where the required form input changed. Instead of setting up the form as an OP, I had to create my form as shown below:
<form action="https://pipeline-poc-ed.s3.amazonaws.com/" method="post" enctype="multipart/form-data" name="upload_form"> <input type="hidden" name="key" value="___" /> <input type="hidden" name="AWSAccessKeyId" value="___" /> <input type="hidden" name="policy" value="___"/> <input type="hidden" name="signature" value="___" /> <input type="hidden" name="x-amz-security-token" value="___" /> File: <input type="file" name="file" /> <br /> <input type="submit" name="submit" value="Upload to Amazon S3" /> </form>
My mistake was that I followed the example in the documentation for boto3 1.9.138 and did not specify "x-amz-security-token" in the form, which turned out to be absolutely necessary. A thoughtless oversight may part, but I hope this helps someone else.
EDIT: My results above were based on N. Virginia's lambda function. When I ran generate_presigned_post(...) in Ohio (the region where my cart is located), I got results similar to OP:
{ "url": "https://__", "fields": { "key": "___", "x-amz-algorithm": "___", "x-amz-credential": "___", "x-amz-date": "___", "x-amz-security-token": "___", "policy": "___", "x-amz-signature": "___" } }
Perhaps function results vary by region?