AWS Builder Center

How I test an S3 presigned URL before sharing it

I generate a short-lived, scoped GET URL, then I open it in a private browser window. If it returns 403, I check the expiry, the bucket policy, and the key first.

Full-stack Developer & Security Researcher
I do not share a presigned URL I have not opened myself.
First, I generate it with a short expiry. Five minutes is enough for a test. I scope it to one object and GET only.
Then I open it in a private browser window. I want the same result the recipient gets, with no signed-in session to hide a problem.
If it returns 403, I check three things in order. Has the URL expired. Does the bucket policy or the object allow this principal to read it. Does the key exist, and is it the key I signed for.
If it works in the private window, I share it. If it does not, I fix the permission, generate a new URL, and test it again. I never extend the expiry to work around a permission error.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article