When I try to access an object in Amazon Simple Storage Service (Amazon S3), I get the error message "Request has expired".
Resolution
Amazon S3 returns this error message when you try to access a presigned URL past the URL's specified expiration date.
For example, in the following response, the expiration date of the presigned URL is October 28, 2022. You get an error message if you try to access the presigned URL after October 28, 2022:
<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
<Expires>2022-10-28T07:13:14Z</Expires>
<ServerTime>2022-10-28T20:03:02Z</ServerTime>
<RequestId>87E1D2CFAAA7F9A6</RequestId>
<HostId>
A9BEluTV2hk3ltdFkixvQFa/yUBfUSgDjptwphKze+jXR6tYbpHCx8Z7y6WTfxu3rS4cGk5/WTQ=
</HostId>
</Error>
To resolve this issue, you must create a new presigned URL to access the object. You can set the URL to expire between 1 minute and 12 hours when you use the Amazon S3 console to set the expiration time. Or, you can set the expiration time up to 7 days when you use AWS Command Line Interface (AWS CLI) or AWS SDKs.
To create a new presigned URL, use one of the following credentials:
- AWS Identity and Access Management (IAM) instance profile
- AWS Security Token Service
- IAM user
Note: If you use a temporary token to create a presigned URL, then the URL expires when the token expires. A presigned URL expires when the credential that you used to create the URL is revoked, deleted, or deactivated. This is true even when you set the URL to expire at a later time than the credential.
Related information
Expiration time for presigned URLs
Why is my presigned URL for an Amazon S3 bucket expiring before the expiration time that I specified?