Cross Account Access

Cross Account Access

Given two accounts, when a user assumes a role into the other account, then the user should see the other account.


In most cases a managed policy is created for the new role. This example uses an existing AWS managed policy for the sake of brevity.

Cross Account Role

Define a bastion role for managing access in the other account.

Type: AWS::IAM::Role
  RoleName: Bastion
  Description: Other Account Bastion
    - arn:aws:iam:policy/IAMFullAccess

Naming an IAM resource can cause an unrecoverable error if you reuse the same template in multiple Regions. To prevent this, AWS recommends using Fn::Join and AWS::Region to create a Region-specific name, as in the following example: {"Fn::Join": ["", [{"Ref": "AWS::Region"}, {"Ref": "MyResourceName"}]]}.

Assume Administrator Role Policy

In the root account, define a policy for developers that will have permission to assume roles in the other account.

  Type: AWS::IAM::ManagedPolicy
    Description: Assume Other Account Bastion Role
      Version: '2012-10-17'
        - Effect: Allow
          Action: sts:AssumeRole
      Resource: !Join
        - - ":"
          - "arn:aws:iam:"
          - "*"
          - "role/Bastion"
          aws:MultiFactorAuthPresent: true

Note: This role is restricted to users that have set up Multi-Factor Authentication in the root account.


Define a cross account administrator group in the root account. This group will contain the users responsible for administering the other account.

  Type: AWS::IAM::Group
    GroupName: "CrossAccountAdmin"
      - !Ref AssumeBastionRole

If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.

Optionally set a PermissionsBoundary to restrict access.


Define the cross account administrator user and assign them to the cross account group.

Type: AWS::IAM::User
  UserName: bastion
    - !Ref CrossAccountAdmin
    Password: Ch@ng3me
    PasswordResetRequired: true

Login Profile

Set a fixed value for the password and always require a password reset.

  Password: String
  PasswordResetRequired: Boolean

Switch Roles

To switch roles:

  1. Sign in as the created owner. MFA is required to switch roles
  2. From the top right of the consoles navigation bar, choose your user name
  3. From the "Switch Roles Page", type the account ID and name of the role
  4. Select a color
  5. Choose "Switch Roles"

Failure to select a color will overwrite that profile in the browser.

The display name and color replace the user name on the navigation bar and the permissions have been assumed.

See all posts