Managing Multiple AWS Accounts with Ease: Configuring AWS CLI Named Profiles

preview_player
Показать описание
Step-by-step instructions for creating AWS CLI named profiles
How to set up IAM roles and permissions for the profiles

Switching between AWS CLI named profiles is a useful feature for managing multiple AWS accounts.

Here's a step-by-step guide on how to do it:

1. First, ensure that you have set up your AWS CLI with named profiles. You can do this by running the command `aws configure --profile profile-name` and providing the necessary information like your access key, secret access key, and default region.

Repeat this for all the profiles you want to set up.

2. To switch between profiles, you can use the `--profile` option along with any AWS CLI command. For example, to list all the EC2 instances in a specific profile, you can run the following command:

aws ec2 describe-instances --profile profile-name

Replace profile-name with the name of the profile you want to use.

3. You can also set a default profile by using the `AWS_DEFAULT_PROFILE` environment variable. This will save you from having to specify the profile name every time you use the AWS CLI. To set a default profile, run the following command:

export AWS_DEFAULT_PROFILE=profile-name

Replace `profile-name` with the name of the profile you want to set as the default.

4. To verify which profile is currently being used, you can run the `aws configure list` command
Рекомендации по теме