Red Bottle
Red Bottle

Reputation: 3080

How to remove assumed IAM role from local

I have an assumed role which I assumed using aws sts assume-role CLI command.

I want to "unassume" this role and switch back to my aws credentials configured in my local system.

How do I acheive this? I have tried doing so by going to the console and clicking the "Revoke Active Sessions" button, but that doesn't seem to be working. I tried rm -r ~/.aws/cli/cache too but in vain. Please help

Upvotes: 2

Views: 3364

Answers (1)

burnah-boiii
burnah-boiii

Reputation: 5914

There's a few things you can do:

  1. You can unset the AWS environment variables in your terminal:
unset AWS_ACCESS_KEY_ID

unset AWS_SECRET_ACCESS_KEY
 
unset AWS_SESSION_TOKEN
  1. You can reconfigure your aws configuration:
aws configure

However, you'll need to make sure there are no environment variables set for your AWS credentials. By default, the AWS CLI looks at your environment variables, then your config file, then your credentials file for credentials to use in CLI commands.

Upvotes: 5

Related Questions