[aws] Add function for deactivating (unset variables) current aws profile

This commit is contained in:
Daniel Carrillo 2020-02-22 20:04:40 +01:00
parent a73bb314cc
commit 272528b439
1 changed files with 12 additions and 1 deletions

View File

@ -135,9 +135,14 @@ function ssh_aws_any {
}
function aws_switch_profile {
echo "Activating profile $1..."
local region
if [[ -z $1 ]]; then
echo "Profile can't be an empty string"
return 1
fi
echo "Activating profile $1..."
export AWS_PROFILE=$1
if [[ -f ~/.aws/credentials ]]; then #&& (( ! ${+AWS_DEFAULT_REGION} ))
region=$(aws configure get region)
@ -148,3 +153,9 @@ function aws_switch_profile {
fi
fi
}
function aws_deactivate_profile {
echo "Deactivating aws profile..."
unset AWS_PROFILE
unset AWS_DEFAULT_REGION
}