bripkens / aws-vault-prompt

A zsh prompt for 99designs/aws-vault to understand what the active AWS session is and when it expires

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aws-vault-prompt

A zsh prompt for 99designs/aws-vault to understand what the active AWS session is and when it expires.

Installation

Download the latest release from the releases page and put it on your $PATH.

Configuration

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.

Example zsh Config

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:

Valid Session

Screenshot 2022-10-17 at 08 36 16

Session that exprires soon

Screenshot 2022-10-17 at 08 36 26

Expired Session

Screenshot 2022-10-17 at 08 36 33

About

A zsh prompt for 99designs/aws-vault to understand what the active AWS session is and when it expires

License:MIT License


Languages

Language:Go 100.0%