Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created October 28, 2021 20:47
Show Gist options
  • Save Voronenko/e805b384d58b20fc4dcfb1a7fac56ee0 to your computer and use it in GitHub Desktop.
Save Voronenko/e805b384d58b20fc4dcfb1a7fac56ee0 to your computer and use it in GitHub Desktop.
An error occurred (InvalidClientTokenId) when calling the ListAccountAliases operation: The security token included in the request is invalid.
Run the sts get-session-token AWS CLI command, replacing the variables with information from your account, resources, and MFA device:
$ aws sts get-session-token --serial-number arn-of-the-mfa-device --token-code code-from-token
You receive an output with temporary credentials and an expiration time (by default, 12 hours) similar to the following:
{
"Credentials": {
"SecretAccessKey": "secret-access-key",
"SessionToken": "temporary-session-token",
"Expiration": "expiration-date-time",
"AccessKeyId": "access-key-id"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment