Skip to content

Instantly share code, notes, and snippets.

@ajkerrigan
Created August 6, 2019 16:55
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
AWS User Info Bookmarklet

Current User Info Bookmarklet for the AWS Console

When logged into the AWS web console it can be helpful to quickly see details of your current identity. This can include:

  • An ARN
  • Your current account alias
  • Issuer info, indicating tools such as aws-vault
  • Your username, which may include a role session name

This bookmarklet is a simple way to parse that information out of the aws-userInfo cookie and return it as pretty printed JSON.

To use this:

  1. Create a new bookmark in your browser, and paste this in as the location:
javascript:(function () {
    function fullDecode (input) {
        let decoded = decodeURIComponent(input);
        return (decoded == input ? decoded : fullDecode(decoded))
    };
    let userInfo = document.cookie.replace(/(?:(?:^|.*;\s*)aws-userInfo\s*\=\s*([^;]*).*$)|^.*$/, "$1");
    alert(JSON.stringify(JSON.parse(fullDecode(userInfo)), null, 4))
})();
  1. Click the bookmark while logged into the AWS web console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment