Improve awslogin function

This commit is contained in:
Andrea Mistrali 2021-10-26 17:15:26 +02:00
parent 66df77560a
commit 85e6b157b5
No known key found for this signature in database
GPG Key ID: 6FB0A77F6D5DA9B2
1 changed files with 9 additions and 7 deletions

View File

@ -1,11 +1,13 @@
if [[ -z "$1" ]]
then
if [ $1 ]; then
export AWS_DEFAULT_PROFILE=$1
export AWS_PROFILE=$1
export AWS_EB_PROFILE=$1
return
elif [ $AWS_PROFILE ]; then
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
echo AWS profile cleared.
return
fi
#saml2aws login -a $1 -p $1
#eval $(saml2aws script -a $1 -p $1 --skip-prompt)
export AWS_DEFAULT_PROFILE=$1
export AWS_PROFILE=$1
export AWS_EB_PROFILE=$1
echo "Available profiles"
grep profile ~/.aws/config|awk '{print $2}' | sed 's/]//g'