A zsh prompt for 99designs/aws-vault to understand what the active AWS session is and when it expires.
Download the latest release from the releases page and put it on your $PATH
.
The prompt is configured with the help of the AWS_VAULT_TERM_PROMPT
, AWS_VAULT_TERM_PROMPT_EXPIRING_SOON
and AWS_VAULT_TERM_PROMPT_EXPIRED
environment variables.
All environments have to be golang format strings. You can use the following placeholders:
%[1]s
: Name of the AWS vault%[2]s
: Name of the default AWS region%[3]d
: Remaining session duration in minutes.
Make sure to place these lines after: source $ZSH/oh-my-zsh.sh
export AWS_VAULT_TERM_PROMPT="$fg_bold[blue]aws:($fg_bold[cyan]%[1]s$fg_bold[blue])$reset_color "
export AWS_VAULT_TERM_PROMPT_EXPIRING_SOON="$fg_bold[blue]aws:($fg_bold[yellow]%[1]s ⏱ %[3]dm$fg_bold[blue])$reset_color "
export AWS_VAULT_TERM_PROMPT_EXPIRED="$fg_bold[blue]aws:($fg_bold[red]%[1]s ⚠️ $fg_bold[blue])$reset_color "
PROMPT=$PROMPT'$(aws-vault-prompt)'
This configuration will result in the following prompt: