Apps

AWS CLI Cache

AWS CLI writes JSON cache files under ~/.aws/cli/cache for temporary STS credentials, role-assumption results, and other refreshable authentication data so repeated commands do not have to request new tokens every time. Those files speed up profiles that use assume-role, SSO, or other temporary credential flows, but they can become stale after permission changes, session expiry, or clock drift. Kudu removes only the cached CLI JSON response and credential artifacts so the AWS CLI fetches fresh data automatically, without touching your configured profiles, access keys, account settings, or command history.

Why clean AWS CLI Cache?

  • Expired STS session cache causes sudden ExpiredToken or UnrecognizedClientException errors even though the profile is configured correctly, and the next command works only after credentials are refreshed
  • Stale assume-role cache keeps old permissions after an IAM policy or trust policy change, so commands return AccessDenied until the CLI fetches a new role session
  • Cached SSO or temporary credential metadata can point to a session that is no longer valid, leading to repeated authentication prompts or login loops during aws s3, ecs, or cloudformation commands
  • System clock corrections or laptop sleep can leave cached expiration timestamps effectively wrong, which shows up as commands failing immediately with token-expired messages
  • Large numbers of old JSON cache files accumulate from many profiles and role switches, making it harder to tell which session is active and wasting disk space in home directories and CI runners
  • Corrupted or partially written cache files after an interrupted shell session can trigger JSON parsing or credential loading failures, and clearing the cache forces a clean re-fetch
  • When the cache directory contains many obsolete entries, the CLI may keep reusing credentials you expected to rotate, causing confusing account or role mismatches until fresh credentials are obtained
What gets cleaned

Cache paths Kudu targets

Windows

~/.aws/cli/cache

macOS

~/.aws/cli/cache

Linux

~/.aws/cli/cache
Frequently asked

Common questions about AWS CLI Cache

Free & open source

Download Kudu and reclaim your disk space.

Available on Windows, macOS, and Linux. No account required, no feature gates, no telemetry without consent. All cleaning targets are open source and community-auditable.