CloudConsole

aws iam update-access-key

Updated 16 November 2026 · How we write and check guides

Short answer

aws iam update-access-key --user-name my-user --access-key-id AKIA... --status Inactive switches an IAM user's access key off without deleting it. Requests signed with an inactive key are rejected, and you can turn it back on with --status Active if something important breaks.

Terminal running aws iam update-access-key --user-name ci-deploy \
A worked example from this page. Copy commands from the text below, not from the image.

What the command does

It changes one key's status between Active and Inactive. Nothing else about the key changes; the secret stays the same. That makes deactivation the safe middle step between "this key looks unused" and deleting it, and the fast first response when a key may have leaked.

The call returns no output on success. Like other IAM changes, it takes effect across AWS within seconds, though not necessarily instantly everywhere.

Syntax

aws iam update-access-key \
  --access-key-id <AKIA...> \
  --status Active|Inactive \
  [--user-name <user>]

Worked examples

Deactivate a key that may be compromised:

aws iam update-access-key --user-name ci-deploy \
  --access-key-id AKIAIOSFODNN7EXAMPLE --status Inactive

Confirm the change:

aws iam list-access-keys --user-name ci-deploy \
  --query "AccessKeyMetadata[].[AccessKeyId,Status]" --output text

Reactivate if a forgotten integration turns out to need it:

aws iam update-access-key --user-name ci-deploy \
  --access-key-id AKIAIOSFODNN7EXAMPLE --status Active

Delete once you are sure (irreversible):

aws iam delete-access-key --user-name ci-deploy \
  --access-key-id AKIAIOSFODNN7EXAMPLE

Responding to a leaked key

  1. Deactivate it now with the command above. Do not wait to find out who uses it.
  2. Find the owner and what it could do. aws iam get-access-key-last-used gives the user; their policies define the blast radius.
  3. Look for misuse in CloudTrail. Filter events by the key ID to see what was called, from where, and whether new users, keys or roles were created.
  4. Issue a replacement with create-access-key for the legitimate workload, or better, move it to a role.
  5. Delete the old key once the replacement is in place, and revoke anything an attacker may have created.

Deciding what is safe to switch off

Before deactivating a key that is merely suspected to be unused, check its last-used date and service. A key last used yesterday by S3 in eu-west-2 is clearly live; one with no recorded use since creation is a strong candidate. Tell the owner of the user before you act if you can, and record the time you deactivated it: if a nightly job fails a few hours later, that timestamp is what connects the two.

Rotation, step by step

StepCommand
Create second keyaws iam create-access-key --user-name ci-deploy
Deploy the new key everywhere(your secret store / CI settings)
Check the old key stopped being usedaws iam get-access-key-last-used --access-key-id <old>
Deactivate the old keyaws iam update-access-key ... --status Inactive
Wait a safe period, then deleteaws iam delete-access-key ...

Gotchas

  • Temporary credentials are not covered. Session credentials already issued by STS to that user (for example via get-session-token) are separate; to cut those off, attach a deny policy conditioned on token issue time, as the IAM console's revoke-sessions feature does for roles.
  • Status values are case-sensitive: Active and Inactive.
  • You can lock yourself out. Deactivating the key your own CLI uses ends your session immediately. Make sure you have another way in.
  • Omitting --user-name targets the calling IAM user's own key.

Questions

Is deactivating an access key reversible?

Yes. Set --status Active again and the same key works. Deleting is not reversible.

How quickly does deactivating a key take effect?

Within seconds in practice, though IAM is eventually consistent, so a request or two may still succeed right after the change.

What happens to applications using an inactive key?

Their requests fail with an authentication error, typically InvalidClientTokenId or a security-token error, until you reactivate the key or give them a new one.

When this happens away from your desk

Leaked-key alerts arrive at any hour and the first move is time-critical. CloudConsole is built to bring AWS alarms and resource details to a phone, with guardrails around production changes.

About the app → · Download on the App Store

Sources