Ask Your Question
3

What is the process for changing from one AWS Organizations account to another using the aws-cli?

asked 2022-08-16 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-08-09 09:00:00 +0000

bukephalos gravatar image

To switch from one AWS Organizations account to another using aws-cli, follow the steps below:

  1. Open a terminal window and ensure the AWS CLI is installed and configured correctly.

  2. Use the following command to switch to the new account:

aws organizations create-standby | jq '.AcountId'
  1. Take note of the AccountId that is returned from the previous command.

  2. Use the following command to assume the new account role:

aws sts assume-role --role-arn arn:aws:iam::<new-account-id>:role/<role-name> --role-session-name awstest
  1. Replace the <new-account-id> and <role-name> placeholders in the previous command with the actual new account and role names.

  2. After running the previous command, a set of temporary credentials will be outputted. Copy and paste these credentials somewhere safe, as they will be required to perform any operations in the new account.

  3. Use the temporary credentials to execute commands in the new account using the AWS CLI.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-08-16 11:00:00 +0000

Seen: 10 times

Last updated: Aug 09 '21