CloudConsole

ExpiredToken: The security token included in the request is expired

Updated 16 November 2026 · How we write and check guides

Short answer

Your request was signed with temporary credentials whose expiry time has passed. Get fresh ones: run aws sso login for an SSO profile, re-run the assume-role step for role credentials, or unset stale AWS_SESSION_TOKEN variables so the SDK can fetch and refresh credentials itself.

How to fix it, in 4 steps: 1. Check what you're using; 2. SSO profile; 3. Assumed role; 4. Need longer sessions?
The diagnosis and fix steps from this page, in the order to try them; commands and details are below.

What the error means

Temporary credentials (access keys starting ASIA, plus a session token) carry an expiry time. Once it passes, every service rejects them:

An error occurred (ExpiredToken) when calling the ListObjectsV2 operation: The provided token has expired.
An error occurred (ExpiredTokenException) when calling the DescribeTable operation: The security token included in the request is expired

Nothing is wrong with your permissions. The identity was valid an hour ago; it simply needs new credentials. The real question is why nothing refreshed them.

Why the credentials were not refreshed

Where the credentials came fromWhy they went stale
Values pasted or exported into the shell (export AWS_SESSION_TOKEN=…)Nothing can refresh environment variables. They die at the session's expiry, often one hour.
IAM Identity Center (SSO) profileThe role credentials and the SSO sign-in session both expire; once the sign-in session ends, a new aws sso login is required.
Manual aws sts assume-role outputDefault session is one hour; role chaining (assuming a role from a role) is capped at one hour regardless of the role's maximum.
A long-running process that copied credentials at start-upYour code read keys once and passed them to a client, bypassing the SDK's refreshing provider.
A large aws s3 cp or sync using pasted credentialsThe transfer outlived the token and fails partway through.

How to fix it

  1. Check what you're using. If aws configure list shows env as the type, the expired values are in your shell.
    aws configure list
    unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
  2. SSO profile: sign in again, then retry.
    aws sso login --profile prod-admin
    aws sts get-caller-identity --profile prod-admin
  3. Assumed role: let the CLI do the assuming so it refreshes automatically. Define a profile instead of exporting keys:
    [profile prod-deploy]
    role_arn = arn:aws:iam::123456789012:role/Deploy
    source_profile = default
    duration_seconds = 3600
    Then aws s3 ls --profile prod-deploy assumes and refreshes the role on demand. See switching roles in the CLI.
  4. Need longer sessions? Raise the role's maximum session duration (up to 12 hours), then request it with duration_seconds. This does not help with role chaining, which stays at one hour.

In applications and pipelines

  • Create SDK clients from the default credential chain instead of passing aws_access_key_id/aws_session_token explicitly. The chain re-reads instance, task and container credentials before they expire.
  • On EC2, ECS and Lambda, never copy role credentials into a config file or environment variable; that freezes them.
  • For CI jobs that assume a role through OIDC, request a session at least as long as the slowest job, and split very long jobs into stages that each get fresh credentials.
  • Tools that call aws configure export-credentials to hand keys to another program get a snapshot; re-run it when the program is long-lived.

Mistakes to avoid

Don't respond by creating long-term access keys "so it stops expiring". That trades a nuisance for a leaked-key risk. Also don't only raise the role's maximum duration without checking the request: the CLI and SDKs default to one hour unless you ask for more, so the change appears to do nothing.

If aws sso login itself fails with a refresh error, that is a separate problem with the cached SSO token; see SSO token has expired and refresh failed.

Questions

How long do AWS temporary credentials last?

It depends on how they were issued. AssumeRole defaults to one hour and can go up to the role's maximum session duration (12 hours at most); role chaining is limited to one hour; SSO role credentials follow the permission set's session duration.

Why does the AWS CLI say the SSO token has expired?

Your IAM Identity Center sign-in session has ended. Run aws sso login --profile <name> to start a new one; the CLI then fetches fresh role credentials automatically.

Why does aws s3 fail with ExpiredToken halfway through a copy?

The transfer is using fixed temporary credentials, usually exported in the shell, and it ran past their expiry. Use a profile with role_arn or an SSO profile so the CLI can refresh them, or request a longer session.

CloudConsole home screen showing what needs attention on a phone, for following up on ExpiredToken away from your desk
When this happens away from your desk

Expired credentials are a laptop problem rather than a production one, but they often block you at the worst moment of an incident. CloudConsole, a phone app for AWS, is built so you can still read alarms, logs and resource state from your phone while your terminal session is being renewed.

Did it start after a deploy? What changed? on the app’s alarm screen lists the deploys and configuration changes from the hour before the alarm fired.

About the app → · Download on the App Store

Sources