Skip to main content

How to Easily Switch IAM Roles Between Accounts

Learn how to switch between multiple AWS account roles using the aws-extend-switch-roles browser extension. Just follow the step-by-step instructions for installing the extension, configuring it with your AWS accounts, and using it to switch roles seamlessly.

Problem

Your company uses a dozen or more AWS accounts with multiple roles. The AWS Web Console only remembers the last 5 roles you used. This gets old really quick and you want a better UX switching roles into AWS accounts.

Solution

tip

The aws-extend-switch-roles browser extension can be used to switch roles across many accounts easily from the browser.

  1. Refer to the aws-extend-switch-roles documentation to install the extension on the browser of your choice.

  2. Follow the AWS CLI Access procedure to set up your local workstation and access the Geodesic shell.

  3. Enter the Geodesic Shell

    • If the option is available, run the aws-accounts gen-switch-roles command to save the aws-extend-switch-roles configuration to your home directory.

      ⨠ aws-accounts gen-switch-roles > /localhost/aws-extend-profiles
    • If not, use this workaround

      ⨠ aws-accounts gen-saml | \
      grep -v source_profile | \
      grep admin -C 1 | \
      grep -v '\-\-' > /localhost/aws-extend-profiles
    • If no aws-accounts use this aws-gen-config

      ⨠ aws-gen-config | \
      grep -v source_profile | \
      grep admin -C 1 | \
      grep -v '\-\-' > /localhost/aws-extend-profiles
  4. In your browser, left-click the aws-extend-switch-roles extension (light-blue icon with a key) and click on the Configuration option.

  5. Open ~/aws-extend-profiles in your home directory, copy its contents, and paste it into the form, then click Save.

  6. Follow the AWS Sign-In Procedure to open the AWS Console.

You should now be able to switch IAM roles across accounts by clicking the extension in your browser and selecting the desired IAM role.

info

See the official extension docs for more configuration options.