Another step in awslogin

This commit is contained in:
Andrea Mistrali 2021-10-27 10:28:45 +02:00
parent 9e4de7b42c
commit 4166f55fd4
No known key found for this signature in database
GPG Key ID: 6FB0A77F6D5DA9B2
1 changed files with 14 additions and 5 deletions

View File

@ -1,8 +1,17 @@
if [ $1 ]; then profile=$1
export AWS_DEFAULT_PROFILE=$1
export AWS_PROFILE=$1 if [ $profile ]; then
export AWS_EB_PROFILE=$1 match=$(grep $profile ~/.aws/config | sed -E 's/\[profile (.+)\]/\1/')
return if [ $match ]; then
echo "Activating $match"
export AWS_DEFAULT_PROFILE=$match
export AWS_PROFILE=$match
export AWS_EB_PROFILE=$match
return
else
echo "No match for $profile"
return
fi
elif [ $AWS_PROFILE ]; then elif [ $AWS_PROFILE ]; then
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
echo AWS profile cleared. echo AWS profile cleared.