To switch from one AWS Organizations account to another using aws-cli, follow the steps below:
Open a terminal window and ensure the AWS CLI is installed and configured correctly.
Use the following command to switch to the new account:
aws organizations create-standby | jq '.AcountId'
Take note of the AccountId that is returned from the previous command.
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
Replace the <new-account-id> and <role-name> placeholders in the previous command with the actual new account and role names.
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.
Use the temporary credentials to execute commands in the new account using the AWS CLI.
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
Asked: 2022-08-16 11:00:00 +0000
Seen: 10 times
Last updated: Aug 09 '21
Why do unauthenticated users not see the Paypal order details on the Paypal invoice?
What is the process for modifying the password of a Windows user account that exists locally?
How can we solve the problem of authenticating the GA4 Analytics Data API using a service account?
When developing an SO file, is it possible to include an additional SO file?
What is the process of automating commands and cronjob expressions stored in a Laravel database?
How can you stop the cursor from moving while yanking to a mark in Vim?