Guide · Amazon S3
You asked for thirty days and got an error. Or the link worked on Monday and returned Request has expired on Tuesday, well short of the week you set. Both come from the same two rules, and once you know them the workarounds sort themselves into good, acceptable and bad.
Rule one: seven days is the ceiling. A presigned URL is a Signature Version 4 request written into a URL. The signature is made with a key derived for one day, one region and one service, and S3 accepts such signatures for at most seven days after signing. Ask for more and the signing fails before any URL exists:
$ aws s3 presign s3://client-bucket/final_master_v3.mov --expires-in 2592000
X-Amz-Expires must be less than a week (in seconds); that is, the given
X-Amz-Expires must be less than 604800 seconds
The largest value that works is --expires-in 604800. There is no account setting, support ticket or region where this is different.
Rule two: the URL dies with the credentials that signed it. If the signer was an IAM user with a long-lived access key, the URL lives for the window you set, up to the seven days. If the signer was anything temporary, an assumed role, an instance profile, an SSO session, a federation token, the URL stops working when that session's token expires, whatever expiry you wrote into it. A role session is often one hour and at most twelve. This is the "worked on Monday, dead on Tuesday" case, and it is the one that catches people, because the URL was generated without an error and looks fine.
When either rule bites, the recipient sees a 403 with a body like this, which is what most people search for:
<Error><Code>AccessDenied</Code><Message>Request has expired</Message></Error>
A presigned URL is a bearer token. Whoever holds it can download until it expires, and there is no way to take it back once it is out: not by deleting it from your chat history, not by asking nicely. Seven days is the ceiling on how long a leaked URL can hurt you. Temporary credentials cut that further for the same reason. Seen that way, the limit is a feature. The problem is only that most delivery work needs a link that outlives it.
s3:GetObject on the bucket, sign with its access key, and keep that key off laptops and out of chat. If seven days is enough, stop here.If your worry is the opposite, that someone on the team signs URLs for a week when an hour would do, the bucket can enforce a shorter life for everyone. A bucket policy can deny any presigned request whose signature is older than a limit you choose, in milliseconds. This one refuses anything older than ten minutes:
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "DenyOldSignatures",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::client-bucket/*",
"Condition": { "NumericGreaterThan": { "s3:signatureAge": "600000" } }
}]
}
The condition key is s3:signatureAge, and where several limits apply the most restrictive wins. It is the one control that lets the bucket owner, rather than each signer, decide how long a link can live.
If the recipient is a system, a presigned URL is right: it needs nothing but the URL. If the recipient is a person, three things usually matter more than the expiry. Can you take the link back if it went to the wrong person? Do you know whether they downloaded it? Does the link look like something a client will trust? A raw presigned URL answers no, no and no. Klarsend's answer to all three is on the Amazon S3 guide, including the IAM policy and the bucket CORS rule it needs. For the revoke question on its own, see how to revoke a presigned URL or SAS token.
Get started
Connect it, send a link, revoke it — in under ten minutes, with no card and no email address.
The core stays free. Premium is €6 a month, VAT included — pricing · refund policy.