5 ms·
This looks like it might help me do something I do multiple times a day. I work with multiple AWS accounts and have to sign in to several different ones each d
by Corrado 7y ago
This looks like it might help me do something I do multiple times a day. I work with multiple AWS accounts and have to sign in to several different ones each day.
Currently, I have to:
- sign in to AWS SSO
- choose an account
- copy the ENV VARs to my clipboard
- select an iTerm2 tab
- paste ENV VARs into the tab
Using 'tip' I think I could automated the last 3 steps. It's a small win, but when you do it multiple times a day it adds up.
- tanin 7y agoYes! That is a great use case. One of tooltip item actions is opening URL. I'm not sure if iTerm2 supports executing stuff through URL. (For example, we can open intellij using idea://.) If not possible, please open a GitHub issue or reply here. We can figure it out together. We might be able to get Tip to support triggering iTerm2 somehow natively. Thank you sharing an interesting use case!
- nathancahill 7y agoCan you use the profiles in ~/.aws/credentials? This is my lifeblood as a freelancer working with many clients and switching AWS accounts all day.
- weiming 7y agoYep. AWS commands take the --profile argument to choose one of the items from the credentials file.
- nicoburns 7y agoYou can also use the following bash/zsh function to quickly set the current default profile (requires ruby): function aws_switch () { local env="$1" local region="$2" export AWS_DEFAULT_PROFILE="$env" export AWS_ENV="$env" export KITCHEN_ENV="$env" export AWS_ACCESS_KEY_ID=$(/usr/bin/env ruby -e "require 'inifile'; puts IniFile.load(File.join(File.expand_path('~'), '.aws', 'credentials'))[ENV['AWS_DEFAULT_PROFILE']]['aws_access_key_id']") export AWS_SECRET_ACCESS_KEY=$(/usr/bin/env ruby -e "require 'inifile'; puts IniFile.load(File.join(File.expand_path('~'), '.aws', 'credentials'))[ENV['AWS_DEFAULT_PROFILE']]['aws_secret_access_key']") if [ -z "$region" ] then export AWS_REGION=$(/usr/bin/env ruby -e "require 'inifile'; puts IniFile.load(File.join(File.expand_path('~'), '.aws', 'config'))['profile ' + ENV['AWS_DEFAULT_PROFILE']]['region']") else export AWS_REGION="$region" fi export AWS_DEFAULT_REGION=$AWS_REGION }
- atmosx 7y agoYou can automate this, even if you have MFAs enabled. I do that through 1Password CLI (for the MFA token) and a script to interact with the idp. We use temp credentials, so after X hours you to generate a new session. I'm just typing the 1Password password on the terminal, I could automate that part too but then essentially I'm removing all auth from my workflow which is dangerous especially on laptops.