1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-01-09 21:38:32 +08:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Junaid Ali
57a0453ae9
Merge 80c3574f6c into 1b4497fc8f 2025-12-06 23:41:37 -08:00
Junaid Ali
80c3574f6c
Update aws.plugin.zsh 2025-09-19 15:20:54 +01:00
Junaid Ali
5f2a6935f7
Update aws.plugin.zsh 2025-09-19 15:20:32 +01:00
Junaid Ali
a7bd198b35
Update README.md 2025-09-19 15:10:54 +01:00
Junaid Ali
3ffd03a59c
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`
2025-09-19 15:02:15 +01:00
2 changed files with 20 additions and 0 deletions

View File

@ -96,3 +96,14 @@ source_profile = source-profile-name
region = us-east-1
output = json
```
## NOTES
1. If we see an issue with a `aws` CLI command for a specific region e.g:
```shell
$ aws eks list-clusters --region me-central-1
An error occurred (UnrecognizedClientException) when calling the ListClusters operation: The security token included in the request is invalid
```
Ensure you're fetching the AWS credentials from a regional STS endpoint i.e:
```shell
$ AWS_STS_REGIONAL_ENDPOINTS=regional gimme-aws-creds
```

View File

@ -43,6 +43,15 @@ 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"
export AWS_PROFILE_REGION=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