Diff
1diff --git a/plugins/aws/README.md b/plugins/aws/README.md
2index e1e355741403d095994278e52ce8bec9fe1a9df1..846bf1414b04f0d4eab9454ac809a7c520dbfd65 100644
3--- a/plugins/aws/README.md
4+++ b/plugins/aws/README.md
5@@ -12,7 +12,7 @@ plugins=(... aws)
6 ## Plugin commands
7
8 * `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
9- It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
10+ It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
11 Run `asp` without arguments to clear the profile.
12 * `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
13
14diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
15index 1c386a3e180b17238ac8315c3bf60d9c2a5a433e..39c47d572a094c039b1deecb0ded71adb1453d6d 100644
16--- a/plugins/aws/aws.plugin.zsh
17+++ b/plugins/aws/aws.plugin.zsh
18@@ -9,7 +9,7 @@ function agr() {
19 # AWS profile selection
20 function asp() {
21 if [[ -z "$1" ]]; then
22- unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
23+ unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
24 echo AWS profile cleared.
25 return
26 fi
27@@ -26,6 +26,8 @@ function asp() {
28 export AWS_PROFILE=$1
29 export AWS_EB_PROFILE=$1
30
31+ export AWS_PROFILE_REGION=$(aws configure get region)
32+
33 if [[ "$2" == "login" ]]; then
34 aws sso login
35 fi
36@@ -195,7 +197,8 @@ compctl -K _aws_profiles asp acp aws_change_access_key
37 # AWS prompt
38 function aws_prompt_info() {
39 if [[ -z $AWS_REGION && -z $AWS_PROFILE ]];then return; fi
40- echo "${ZSH_THEME_AWS_PROFILE_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX:=>} ${ZSH_THEME_AWS_REGION_PREFIX:=<region:}${AWS_REGION}${ZSH_THEME_AWS_REGION_SUFFIX:=>}"
41+ region=${AWS_REGION:-${AWS_DEFAULT_REGION:-$AWS_PROFILE_REGION}}
42+ echo "${ZSH_THEME_AWS_PROFILE_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_PROFILE_SUFFIX:=>} ${ZSH_THEME_AWS_REGION_PREFIX:=<region:}${region}${ZSH_THEME_AWS_REGION_SUFFIX:=>}"
43 }
44
45 if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then