Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in AWS by (19.1k points)

(1.) After successfully configuring a second profile for the AWS CLI, I unsuccessfully tried to set the profile to user2 in my bash session with the following command:

export AWS_PROFILE=user2

... per the advice here: https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html

(2.) The following command works:

aws s3 ls --profile user2

So I know that the AWS CLI and the user2 profile are both working on my computer.

(3.) However, when I subsequently (that is, after entering "export AWS_PROFILE=user2") try something like:

aws s3 ls

... AWS's response assumes that I want to query it as the default user (NOT user2)

(4.) So the only way I can use the user2 profile from the command line is by continuing to append "--profile user2" to every single command, which is tedious.

(5.)

echo $AWS_PROFILE

yields:

>> user2

, as expected.

1 Answer

0 votes
by (44.4k points)

Worked for me:

export AWS_DEFAULT_PROFILE=user2

Afterwards, commands like this can be handled from the account:

aws s3 ls

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories

...