Skip to content

Instantly share code, notes, and snippets.

@dustydecapod
Created January 11, 2019 19:34
Show Gist options
  • Save dustydecapod/33aaf5de2d14fe4ccc8c975588a4872b to your computer and use it in GitHub Desktop.
Save dustydecapod/33aaf5de2d14fe4ccc8c975588a4872b to your computer and use it in GitHub Desktop.
aws-env manager
aws-env () {
if [[ -n "$1" ]]; then
if [[ ! -f ~/.aws/credentials ]]; then
print -P "%F{red}No AWS Credentials Found%f"
return
fi
if [[ $(grep -F \[$1\] ~/.aws/credentials) = "" ]]; then
print -P "%F{red}Environment '$1' not found in AWS credentials file%f"
return
fi
export AWS_PROFILE="$1"
else
unset AWS_PROFILE
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment