amazon-web-servicesamazon-s3pre-signed-url

Is it considered bad practice to a new generate presigned URL per HTTP request?


I've been looking through the presigned URL documentation, and have not encountered much information about how often I can generate these presigned URLs. Judging by the length of the identifier, I'm thinking it's probably collision-safe to generate a new one for every URL request.

I think a more conventional method is to run a cron job to generate a new one and store it in a record DB with the file key, and this would be perfectly doable, but I was wondering if I could skip this step and just generate it on the fly.


Solution

  • There is no way to have a presigned url without expiry time and the maximum expiry time you can set is 1 week. These URLs are designed to be temporary to allow users to access your S3 bucket, either for READ the object or WRITE an Object (or update an existing object).

    So as an answer, it is not a bad practice to generate a new presigned URL per request since its nature to be temporary.