I tried to find any information about the length (not the expiration time) of the s3 signed URL but haven't succeeded. Does anyone know how many characters can be in that URL? Let's say I have a file in s3 bucket and want to get a download link which is s3 signed URL. So how many characters would be there on the link and would it be different for different files?
Asked
Active
Viewed 2,299 times
2
-
The presigned URL contains both the bucket name and key, so at the least, the max would be around 1400 bytes (1024 bytes for the key, 63 for the bucket name, ~300 for the other params). It could be bigger if you add more signed headers. – Anon Coward Feb 03 '22 at 17:43
-
Since each URL character is one byte, the conversion should be straight forward. – Anon Coward Feb 03 '22 at 17:47
-
Correct, the file size and content type is not normally added to the presigned URL. – Anon Coward Feb 03 '22 at 18:57
-
Thank you for the insightful information! Do we have an official AWS link that talks about the usual/expected length of a pre-signed URL? @AnonCoward – Manas Feb 13 '23 at 03:39
-
@Manas: Nothing I'm aware of specifically about the length, you'll need to work through the [documentation on the signature process](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) and work out how long each part can be. – Anon Coward Feb 13 '23 at 04:22
1 Answers
0
There is no official limit from AWS.
I've encountered a presigned URL for an S3 object of 1669 characters. Which is close to the unofficial URL length limit of 2 KB.
The query attributes in my URL were:
X-Amz-Security-Token
= <1230 characters, Base64- and percent-encoded>X-Amz-Algorithm
=AWS4-HMAC-SHA256
X-Amz-Date
=20230309T223106Z
X-Amz-SignedHeaders
=host
X-Amz-Expires
=28800
X-Amz-Credential
= <63 characters>X-Amz-Signature
= <64 characters>
Attributes alone take up 1519 bytes. And all of them are important and cannot be stripped nor modified.

Andriy Makukha
- 7,580
- 1
- 38
- 49