mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
fix(aws): set region from default profile
By default when there is no region set: ``` $ asp <my-profile> $ env | grep -i aws AWS_DEFAULT_PROFILE=<my-profile> AWS_PROFILE=<my-profile> AWS_EB_PROFILE=<my-profile> AWS_REGION= AWS_DEFAULT_REGION= ``` we get this error for this command if we are using regional STS endpoints: ``` $ aws sts get-caller-identity | jq .Arn Invalid endpoint: https://sts..amazonaws.com ``` This PR ensures that a default region is always set. By default comes from `default` profile configuration, and defaults to `us-east-1`
This commit is contained in:
parent
c87eb79140
commit
3ffd03a59c
1 changed files with 8 additions and 0 deletions
|
|
@ -43,6 +43,14 @@ function asp() {
|
|||
export AWS_EB_PROFILE=$1
|
||||
|
||||
export AWS_PROFILE_REGION=$(aws configure get region)
|
||||
if [[ -z "${AWS_PROFILE_REGION}" ]]; then
|
||||
if [[ -z "${available_profiles[(r)default]}" ]]; then
|
||||
echo "region defaulting to us-east-1"
|
||||
else
|
||||
export AWS_PROFILE_REGION=$(aws configure get region --profile default)
|
||||
fi
|
||||
fi
|
||||
export AWS_REGION=$AWS_PROFILE_REGION
|
||||
|
||||
_aws_update_state
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue