mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-12 21:39:48 +01:00
fix(aws): pass default region to fetch regions (#12175)
Co-authored-by: Gauthier Delacroix <no@email.com>
This commit is contained in:
parent
8b2ce98578
commit
e195c7cb43
1 changed files with 10 additions and 1 deletions
|
@ -202,8 +202,17 @@ function aws_change_access_key() {
|
|||
}
|
||||
|
||||
function aws_regions() {
|
||||
local region
|
||||
if [[ $AWS_DEFAULT_REGION ]];then
|
||||
region="$AWS_DEFAULT_REGION"
|
||||
elif [[ $AWS_REGION ]];then
|
||||
region="$AWS_REGION"
|
||||
else
|
||||
region="us-west-1"
|
||||
fi
|
||||
|
||||
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
|
||||
aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
||||
aws ec2 describe-regions --region $region |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
||||
else
|
||||
echo "You must specify a AWS profile."
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue