Skip to content

dotbrains/awsw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

awsw

awsw

CI Release Go Report Card License: MIT

Go AWS Kubernetes Cobra macOS Linux

"One command, any account."

A lightweight CLI for seamlessly switching between AWS SSO accounts and EKS cluster contexts. Switch account → switch kubectl context → use k9s / kubectl against the right cluster immediately.

Installation

Via Homebrew

brew tap dotbrains/tap
brew install awsw

From source

git clone https://github.com/dotbrains/awsw.git
cd awsw
make install

Quickstart

# 1. Generate AWS config and discover EKS clusters
awsw setup

# 2. Authenticate via SSO (opens browser)
awsw login

# 3. Switch to an account
awsw dev-eks

# 4. Use kubectl / k9s as normal — it's already pointing at the right cluster
k9s

Shell Integration

awsw needs to set AWS_PROFILE in your current shell. Add one of the following to your shell rc file:

fish (~/.config/fish/config.fish):

awsw init fish | source

bash (~/.bashrc):

eval "$(awsw init bash)"

zsh (~/.zshrc):

eval "$(awsw init zsh)"

Commands

awsw

Interactive mode. Presents a fuzzy-searchable list via fzf. EKS profiles show one line per cluster:

$ awsw
  dev-ro                dev (111111111111) ReadOnlyAccess
  my-cluster-dev        dev (111111111111) eng-eks
> my-cluster-staging    staging (222222222222) eng-eks
  prod-ro               production (333333333333) ReadOnlyAccess

→ AWS_PROFILE=it-eks
→ kubectl context: my-cluster-staging
Ready.

awsw <alias-or-cluster>

Switch by profile alias or cluster name:

$ awsw dev-eks
→ AWS_PROFILE=dev-eks
→ kubectl context: my-cluster-dev
Ready.

$ awsw my-cluster-staging
→ AWS_PROFILE=it-eks
→ kubectl context: my-cluster-staging
Ready.

awsw login

Authenticate the shared SSO session. Skips the browser if already authenticated. Use --force to re-authenticate.

awsw status

Show current state:

$ awsw status
AWS Profile:  dev-eks
Account:      111111111111
Role:         eng-eks/nicholas
Kube Context: dev-eks

awsw setup

Generate ~/.aws/config with all SSO profiles and populate ~/.kube/config with EKS cluster contexts using human-friendly names.

Profiles

Alias Account ID Role EKS
dev-ro dev 111111111111 ReadOnlyAccess
dev-eks dev 111111111111 eng-eks
it-eks staging 222222222222 eng-eks
prod-ro production 333333333333 ReadOnlyAccess

Dependencies

License

MIT

About

A lightweight CLI for seamlessly switching between AWS SSO accounts and EKS cluster contexts. Switch account → switch kubectl context → use 'k9s'/ 'kubectl' against the right cluster immediately.

Resources

License

Contributing

Stars

Watchers

Forks

Contributors