Skip to content

Instantly share code, notes, and snippets.

@leite08
Created May 3, 2025 12:29
Show Gist options
  • Save leite08/d44428f99da773480d86cedaa610dc84 to your computer and use it in GitHub Desktop.
Save leite08/d44428f99da773480d86cedaa610dc84 to your computer and use it in GitHub Desktop.
Update roles on AWS Switch Role

AWS provides a way to switch accounts in the same browser using "Switch role": https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html

Once you switch to another role/account, it will stay on that browser's "history" - it uses cookies to store the list of roles you switched to.

If you want to update that list, currently the only way is to update the cookie.

NOTE: you'll need to URL-encode the updated value before updating it in the browser's cookie.

In chrome, similar for other browsers:

  1. Navigate to Application > Cookies
  2. Search for the cookie noflush_awsc-roleInfo
  3. In the cookie valye, select "Show URL-decoded"
  4. Copy the value to a text editor, make the changes
  5. URL-encode the updated JSON:
    • use a tool like DevUtils (MacOS) or an online tool
    • can also use JS: https://jsfiddle.net/510myzst/1/ (remember to remove the quotes at the start/end before using the output)
  6. Replace the existing value for noflush_awsc-roleInfo

Inspired by: https://www.reddit.com/r/aws/comments/46fn6v/clear_role_histotry/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment