Last active
October 23, 2021 22:23
-
-
Save voidrot/ed1f22c0a9338f016ea29b10a5a1b923 to your computer and use it in GitHub Desktop.
AWS Auto Profile Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function makes use of ASDF (https://asdf-vm.com/) and its awscli plugin but can also be | |
# easily modified to use a standard awscli install | |
function aws() { | |
if [ ! -z "$AWS_PROFILE" ]; then | |
asdf exec aws --profile $AWS_PROFILE $@ | |
elif [ -f ./.aws-profile ]; then | |
local profile | |
profile=$(cat ./.aws-profile | head -n 1) | |
asdf exec aws --profile $profile $@ | |
else | |
asdf exec aws $@ | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment