11<div align =" center " >
2- <img src =" https://github. com/KeeCLI /kee.rs/blob /main/kee.png " alt =" Kee " />
2+ <img src =" https://raw.githubusercontent. com/keecli /kee.rs/refs/heads /main/kee.png " alt =" Kee " />
33</div >
44
55![ OSX] ( https://img.shields.io/badge/-OSX-black ) ![ OSX] ( https://img.shields.io/badge/-Linux-red ) ![ OSX] ( https://img.shields.io/badge/-Windows-blue )
66
7- A simple tool to manage multiple AWS accounts with SSO support and easy account access.
8-
97` Kee ` creates isolated sub-shells for each AWS account, ensuring no credentials are stored locally while providing seamless account management.
108
11- 🦀 — This is the ** Rust** implementation of the original [ Python implementation] ( https://github.com/KeeCLI/kee.py ) , providing identical functionality with the performance and safety benefits of Rust, while maintaining complete compatibility with existing configurations and workflows.
9+ ## Features
10+
11+ - 🔐 ** SSO integration** : Full support for AWS SSO authentication
12+ - 🚀 ** Easy account access** : Use any configured account with a single command
13+ - 🐚 ** Sub-shell isolation** : Each account runs in its own sub-shell with proper credential isolation
14+ - 📝 ** Custom aliases** : Use friendly names for your AWS accounts
15+ - 🔍 ** Account management** : Easily list, add, and remove accounts
16+ - 🚫 ** No stored credentials** : No AWS credentials are stored anywhere - uses AWS SSO tokens
17+ - 🎨 ** Shell integration** : Shows current account in your shell prompt
18+ - ⚡ ** Auto-refresh** : Automatically handles SSO token refresh when needed
19+
20+ 🐍 — In case you are looking for an alternative, check out the ** Python** [ implementation] ( https://github.com/keecli/kee.py ) .
21+
22+ ## Security notes
23+
24+ - ** No credential storage** : ` Kee ` never stores AWS access keys or secrets
25+ - ** SSO token management** : Uses AWS CLI's built-in SSO token caching
26+ - ** Sub-shell isolation** : Each account session is isolated in its own shell
27+ - ** Automatic cleanup** : Environment variables are cleared when exiting sub-shells
1228
1329## Why Rust?
1430
@@ -18,8 +34,6 @@ A simple tool to manage multiple AWS accounts with SSO support and easy account
1834- 👌 ** Zero dependencies** : No Python runtime required
1935- ⚡️ ** Concurrent** : Built-in concurrency support for future enhancements
2036
21- > For a list of features, take a look a the [ Python implementation] ( https://github.com/KeeCLI/kee.py ) .
22-
2337## Installation
2438
2539### Prerequisites
@@ -72,110 +86,220 @@ cargo build --release
7286cp target/release/kee ~ /.local/bin/ # Make sure ~/.local/bin is in your PATH
7387```
7488
75- ## Feature comparison
76-
77- | Feature | Python Version | Rust Version | Notes |
78- | ------------------------- | -------------- | ------------- | ------------------------------- |
79- | ** SSO integration** | ✅ | ✅ | Identical AWS CLI integration |
80- | ** Sub-shell isolation** | ✅ | ✅ | Same environment management |
81- | ** Account management** | ✅ | ✅ | Add, use, list, remove accounts |
82- | ** Session management** | ✅ | ✅ | Prevents nested sessions |
83- | ** Config file format** | ✅ | ✅ | Same JSON structure |
84- | ** AWS config management** | ✅ | ✅ | Same file handling |
85- | ** Cross-platform** | ✅ | ✅ | Windows, macOS, Linux |
86- | ** Error handling** | ✅ | ✅ | Comprehensive error management |
87- | ** Performance** | Good | ** Excellent** | Compiled binary |
88- | ** Memory usage** | Higher | ** Lower** | No runtime overhead |
89- | ** Startup time** | ~ 100ms | ** ~ 5ms** | No interpreter startup |
90- | ** Binary size** | N/A | ** ~ 1.5MB** | Single executable |
89+ ## Quick Start
9190
92- ## Usage
91+ ### 1. Add Your First Account
9392
9493``` bash
95- # Add an account
9694kee add mycompany.dev
95+ ```
96+
97+ This will:
9798
98- # Use an account
99+ - Run ` aws configure sso --profile company.dev `
100+ - Prompt you for your SSO configuration (start URL, region, etc.)
101+ - Open your browser for SSO authentication
102+ - Let you select your AWS account and role interactively
103+ - Automatically save the configuration to ` Kee `
104+
105+ ### 2. Use an Account
106+
107+ ``` bash
99108kee use mycompany.dev
109+ ```
110+
111+ This will:
112+
113+ - Check if SSO credentials are valid
114+ - Automatically run ` aws sso login ` if needed
115+ - Start a sub-shell with AWS credentials configured
116+ - Update your shell prompt to show the active account
117+
118+ ### 3. Work with AWS
119+
120+ Inside the sub-shell, all AWS CLI commands will use the selected account:
100121
101- # List accounts
122+ ``` bash
123+ (kee:mycompany.dev) $ aws s3 ls
124+ (kee:mycompany.dev) $ aws ec2 describe-instances
125+ (kee:mycompany.dev) $ exit # Terminate the session and return to your main shell
126+ ```
127+
128+ ## Commands
129+
130+ ### Add an account
131+
132+ ``` bash
133+ kee add < account_name>
134+ ```
135+
136+ Interactively configure a new AWS account with SSO settings.
137+
138+ ### Use an account
139+
140+ ``` bash
141+ kee use < account_name>
142+ ```
143+
144+ Use an account and start a sub-shell with AWS credentials.
145+
146+ ### List all accounts
147+
148+ ``` bash
102149kee list
150+ ```
151+
152+ Show all configured accounts and their details.
153+
154+ ### Show current account
103155
104- # Show current account
156+ ``` bash
105157kee current
158+ ```
106159
107- # Remove an account
108- kee remove mycompany.dev
160+ Display which account is currently active (if any).
109161
110- # Help
111- kee --help
162+ ### Remove an account
163+
164+ ``` bash
165+ kee remove < account_name>
112166```
113167
114- ## Development
168+ Removes an account configuration from ` Kee ` and the AWS config file.
169+
170+ ## How It Works
171+
172+ ### Configuration storage
115173
116- ### Building
174+ - ` Kee ` stores its configuration in ` ~/.aws/kee.json `
175+ - AWS profiles are created in ` ~/.aws/config ` with the naming pattern using ` <account_name> `
176+ - No AWS credentials are stored - only SSO configuration
177+
178+ ### Sub-shell environment
179+
180+ When you use an account, ` Kee ` :
181+
182+ 1 . Validates SSO credentials (refreshes if needed)
183+ 2 . Updates shell prompt to show current account
184+ 3 . Starts a new shell session
185+ 4 . Cleans up when you exit
186+
187+ ### Session management
188+
189+ ` Kee ` prevents you from starting a sub-shell while already in one:
117190
118191``` bash
119- # Debug build
120- cargo build
192+ (kee:mycompany.dev) $ kee use mycompany.prod
121193
122- # Release build (optimized)
123- cargo build --release
194+ You already are in a Kee session for: mycompany.dev
195+ Exit the current session first by typing ' exit'
196+ ```
197+
198+ ### Shell prompt integration
124199
125- # Run tests
126- cargo test
200+ Your shell prompt will show the active account:
127201
128- # Check code
129- cargo check
130- cargo clippy
202+ ``` bash
203+ (kee:mycompany.dev) user@hostname:
204+ ```
205+
206+ ## Environment variables
207+
208+ When you're in a ` Kee ` session, the following environment variables are set:
209+
210+ - ` AWS_PROFILE ` - The AWS profile name (e.g., ` mycompany.dev ` )
211+ - ` AWS_REGION ` - The AWS region (e.g., ` ap-southeast-2 ` )
212+ - ` KEE_CURRENT_ACCOUNT ` - The ` Kee ` account name (e.g., ` mycompany.dev ` )
213+ - ` KEE_ACTIVE_SESSION ` - Set to ` 1 ` to indicate an active ` Kee ` session
214+ - ` PS1 ` - Updated to show the current account in your prompt (Unix-like systems only)
215+
216+ These variables help ` Kee ` manage sessions and prevent nested sub-shells.
217+
218+ ## Configuration files
219+
220+ ### Kee configuration (` ~/.aws/kee.json ` )
221+
222+ ``` json
223+ {
224+ "accounts" : {
225+ "mycompany-prod" : {
226+ "profile_name" : " mycompany.dev" ,
227+ "sso_start_url" : " https://mycompany.awsapps.com/start" ,
228+ "sso_region" : " ap-southeast-2" ,
229+ "sso_account_id" : " 123456789012" ,
230+ "sso_role_name" : " AdministratorAccess" ,
231+ "region" : " ap-southeast-2" ,
232+ "session_name" : " mycompany.dev"
233+ }
234+ },
235+ "current_account" : null
236+ }
131237```
132238
133- ## Performance benchmarks
239+ ### AWS config (` ~/.aws/config ` )
240+
241+ ``` ini
242+ [profile mycompany.dev]
243+ sso_start_url = https://mycompany.awsapps.com/start
244+ sso_region = ap-southeast-2
245+ sso_account_id = 123456789012
246+ sso_role_name = AdministratorAccess
247+ region = ap-southeast-2
248+ output = json
134249
135- | Operation | Python | Rust | Improvement |
136- | ---------------- | ------ | ------ | -------------- |
137- | ** Startup** | ~ 100ms | ~ 5ms | ** 20x faster** |
138- | ** Config load** | ~ 10ms | ~ 1ms | ** 10x faster** |
139- | ** Memory usage** | ~ 25MB | ~ 2MB | ** 12x less** |
140- | ** Binary size** | N/A | ~ 1.5MB | Single file |
250+ [sso-session mycompany.dev]
251+ sso_start_url = https://mycompany.awsapps.com/start
252+ sso_region = ap-southeast-2
253+ ```
141254
142255## Cross-platform support
143256
144- ** Identical support across: **
257+ ` Kee ` works on:
145258
146259- ** macOS** : Full support with shell prompt integration
147260- ** Linux** : Full support with shell prompt integration
148261- ** Windows** : Full support (prompt integration not available)
149262
150- ** Platform-specific optimizations:**
263+ ## Troubleshooting
264+
265+ ### SSO login issues
151266
152- - ** Windows** : Uses ` COMSPEC ` for shell detection
153- - ** Unix** : Uses ` SHELL ` environment variable
154- - ** All** : Proper path handling with ` std::path `
267+ If SSO login fails:
155268
156- ## Migration from the Python version
269+ ``` bash
270+ # Manual SSO login
271+ aws sso login --profile < account_name>
157272
158- ** Zero migration required:**
273+ # Then try using again
274+ kee use < account_name>
275+ ```
159276
160- - Same configuration files (` ~/.aws/kee.json ` )
161- - Same AWS config format
162- - Same command-line interface
163- - Same environment variables
277+ ### Profile not found
164278
165- ** Drop-in Replacement: **
279+ If you get "profile not found" errors:
166280
167281``` bash
168- # Remove the Python version
169- rm /usr/local/bin/kee
282+ # Check AWS config
283+ cat ~ /.aws/config
170284
171- # Or via Pip
172- pip uninstall kee
285+ # Re-add the account if needed
286+ kee remove < account_name>
287+ kee add < account_name>
288+ ```
289+
290+ ### Permission issues
291+
292+ If you get permission errors:
293+
294+ ``` bash
295+ # Check AWS credentials
296+ aws sts get-caller-identity --profile < account_name>
173297
174- # Install Rust version
175- cargo install --path . --force
298+ # Refresh SSO login
299+ aws sso login --profile < account_name >
176300```
177301
178- ## Future enhancements (specific to Rust)
302+ ## Future enhancements
179303
180304- ** Async AWS API calls** for faster credential validation
181305- ** Parallel account operations** for bulk management
@@ -184,8 +308,6 @@ cargo install --path . --force
184308- ** Plugin system** with dynamic loading
185309- ** TUI interface** with real-time updates
186310
187- ## Distribution
188-
189311** Binary distribution:**
190312
191313- Single executable file
@@ -195,25 +317,22 @@ cargo install --path . --force
195317
196318** Package managers:**
197319
198- - ** Cargo** : ` cargo install kee `
320+ - ** Cargo** : ` cargo install kee ` (when published)
199321- ** Homebrew** : ` brew install kee ` (when published)
200322- ** Scoop** : ` scoop install kee ` (Windows, when published)
201- - ** APT/YUM** : Native packages possible
323+ - ** APT/YUM** : Native packages possible (when published)
202324
203325## Contributing
204326
205- Same contribution guidelines as Python version, plus:
206-
2073271 . Fork the repository
2083282 . Create a feature branch
2093293 . Make your changes
210- 4 . Add tests if applicable
211- 5 . Submit a pull request
212-
213- ** Rust-specific:**
330+ 4 . Add tests, if applicable
331+ 5 . Test your changes: ` make test `
332+ 6 . Submit a pull request
214333
215- - Follow ` rustfmt ` formatting
216- - Pass ` clippy ` lints
334+ > Follow ` rustfmt ` formatting
335+ > Pass ` clippy ` lints
217336
218337> There is a utilities script which will set up a ` pre-commit ` hook to run some basic checks on your code before you commit.
219338
0 commit comments