I had an AWS account configured to work with the CLI. The free tier expired so I setup another account. I created an IAM user ran aws configure
and put in the credentials for that user. I have the default profile setup with that users credentials as well.
From the cli if I run the command aws s3 ls
it will always show the buckets from the old account. If I specify the profile using aws s3 ls --profile GrantM
then it lists the buckets from the correct account and IAM user.
The environment variables are set to the new user also. Can someone explain this and how to switch it to use my new account?
When you use
aws configure
without any additional arguments it should allow you to amend the default profile, which is the one that is being accessed when you specify no profile. By amending this you will not need to specify the--profile
flag.If you would also like to amend over named profiles you would simply use
aws configure --profile $PROFILE_NAME
, where you can just as above replace the credentials currently stored in the configuration.Alternatively for Linux/MacOS you can access your credentials in
~/.aws/credentials
or for Windows in%USERPROFILE%\.aws\credentials
. You can modify these files to replace any values.More information is available on the Named profiles documentation page.