In this tutorial, we'll walk through the steps to share administrator access from one AWS account (Account A) to another AWS account (Account B). This will allow users in Account B to manage resources and perform administrative tasks on resources in Account A. We'll use AWS Identity and Access Management (IAM) roles and cross-account access to achieve this.
- You must have administrative access to both AWS accounts (Account A and Account B).
- Familiarity with AWS IAM and its concepts.
- Log in to the AWS Management Console for Account A.
- Navigate to the IAM service.
- Click on "Roles" in the left navigation pane.
- Click on the "Create role" button.
- Choose "Another AWS account" as the trusted entity.
- Enter the AWS account ID of Account B in the "Account ID" field.
- Click "Next: Permissions."
- Select the appropriate policies or attach the "AdministratorAccess" policy to this role.
- Click "Next: Tags" (optional) and add any relevant tags for the role.
- Click "Next: Review."
- Provide a name for the role (e.g., "AccountB-Admin-Access") and an optional description.
- Click "Create role."
- After creating the role, click on the role you just created in the IAM Roles list.
- Click the "Trust relationships" tab.
- Click "Edit trust relationship."
- Update the JSON policy document with the following trust relationship, replacing "ACCOUNT_B_ID" with the AWS account ID of Account B.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::ACCOUNT_B_ID:root"
},
"Action": "sts:AssumeRole"
}
]
}
- Click "Update Trust Policy."
- Go back to the "Summary" tab of the role you created in Account A.
- Copy the Role ARN, which looks like this:
arn:aws:iam::ACCOUNT_A_ID:role/AccountB-Admin-Access
. Save it for the next step.
- Log in to the AWS Management Console for Account B.
- Navigate to the IAM service.
- Click on "Roles" in the left navigation pane.
- Click on "Create role."
- Choose "Another AWS account" as the trusted entity.
- Enter the AWS account ID of Account A in the "Account ID" field.
- Under "Permissions," attach policies that define what permissions the users in Account B will have in Account A.
- Click "Next: Tags" (optional) and add any relevant tags for the role.
- Click "Next: Review."
- Provide a name for the role (e.g., "AccountA-Admin-Access") and an optional description.
- Click "Create role."
- In Account B's IAM, go to "Roles" and click on the role you created in Step 4 (e.g., "AccountA-Admin-Access").
- Click on the "Trust relationships" tab and ensure it has the correct trust relationship as mentioned in Step 2.
- Use the "Switch Role" option in the AWS Management Console to test access from Account B to Account A using the Role ARN from Step 3.
That's it! You have now successfully shared administrator access from Account A to Account B in AWS. Users in Account B can now manage resources and perform administrative tasks in Account A using the IAM role you created.