6
votes

Is it possible to generate a presigned URL for an S3 object using the AWS REST API rather than the SDKs? I can't find the topic for this in the AWS REST API documentation.

2
I'm assuming you want to minimize the size of code imported. I don't believe there is an API request you can make for this. You could extract the signing code from the AWS SDK source (not sure how simple this would be) or write your own signing code using a combination of the SDK source and AWS's documentation. Or you could write a trivial Lambda function that maps an S3 key to a pre-signed URL and then have your client invoke the Lambda (or make an API call vi API Gateway). - jarmod

2 Answers

13
votes

You won't find a REST endpoint for generating a presigned URL because that URL is generated entirely client-side. :) The python code used to generate those URLs can be found in the generate_presigned_url method of the signers.py in the botocore library.

You can verify the client-sidedness of the presigned-url generation in two ways:

  1. Grab a network traffic analyzer and compare the traffic of a bucket-list operation and a generate-presigned-url operation

  2. Generate a presigned-url for a non-existent bucket using invalid credentials and marvel as a totally non-fucntional presigned url is still happily generated for you

0
votes
  1. I disagree with the answer. You can generate Pre-SignedURL with lambda functions connected to your POST request. Go to Boto3 library and search Pre-signed URL and you can get the code. When a bucket and key is send back to the API Gateway, A Pre-SignedURL is generated. You can also generate Binary Images.