Switch aws-cli's profile

If you have a multiple aws account, you should want to switch these accounts.

Aws-cli provides AWS_DEFAULT_PROFILE environment variable. When you use aws-cli, use profile in this variable.

You can easily switch profile with using the following code.

awsc () {
  export AWS_DEFAULT_PROFILE=$(grep -oE "(\[).+(\])" ~/.aws/credentials | tr -d [] | peco)
}

Please put this code to .bash_profile.

You can select a profile in your credential.

Note: Dependency

Did you find this post useful? Show some love!
Classic DEV Post from May 19

Developer Interview Bloopers

Some things I've learned in my journey to find a new job.

READ POST
Follow @wweihs to see more of their posts in your feed.
Takeshi Kondo
Site Reliability Engineer
Trending on dev.to
How to Be Really Awesome at Your Job and Not Be A Complete Jerk
#interpersonalskills #leadership #career
What's in your bookmarks bar?
#tools #productivity #discuss
What are good ways to learn software architecture and systems design?
#advice #discuss #architecture #reading
What are your programming hype songs?
#discuss #music #productivity
What has programming taught you that you keep-in-mind/use in your daily life?
#discuss
The Shell Introduction I Wish I Had
#shell #productivity #beginners #bash
Who's looking for open source contributors? (July 16 edition)
#discuss #opensource
On esoteric languages
#discuss #esoteric #code #fun