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,217 @@ 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:
98+
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 `
97104
98- # Use an account
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
100117
101- # List accounts
118+ ### 3. Work with AWS
119+
120+ Inside the sub-shell, all AWS CLI commands will use the selected account:
121+
122+ ``` bash
123+ (mycompany.dev) $ aws s3 ls
124+ (mycompany.dev) $ aws ec2 describe-instances
125+ (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.
103153
104- # Show current account
154+ ### Show current account
155+
156+ ``` bash
105157kee current
158+ ```
159+
160+ Display which account is currently active (if any).
161+
162+ ### Remove an account
163+
164+ ``` bash
165+ kee remove < account_name>
166+ ```
167+
168+ Removes an account configuration from ` Kee ` and the AWS config file.
169+
170+ ## How It Works
171+
172+ ### Configuration storage
106173
107- # Remove an account
108- kee remove mycompany.dev
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
109177
110- # Help
111- kee --help
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:
190+
191+ ``` bash
192+ (mycompany.dev) $ kee use mycompany.prod
193+
194+ You already are in a Kee session for: mycompany.dev
195+ Exit the current session first by typing ' exit'
112196```
113197
114- ## Development
198+ ### Shell prompt integration
115199
116- ### Building
200+ Your shell prompt will show the active account:
117201
118202``` bash
119- # Debug build
120- cargo build
203+ (mycompany.dev) user@hostname:
204+ ```
121205
122- # Release build (optimized)
123- cargo build --release
206+ ## Environment variables
124207
125- # Run tests
126- cargo test
208+ When you're in a ` Kee ` session, the following environment variables are set:
127209
128- # Check code
129- cargo check
130- cargo clippy
210+ - ` AWS_PROFILE ` - The AWS profile name (e.g., ` mycompany.dev ` )
211+ - ` KEE_CURRENT_ACCOUNT ` - The ` Kee ` account name (e.g., ` mycompany.dev ` )
212+ - ` KEE_ACTIVE_SESSION ` - Set to ` 1 ` to indicate an active ` Kee ` session
213+ - ` PS1 ` - Updated to show the current account in your prompt (Unix-like systems only)
214+
215+ These variables help ` Kee ` manage sessions and prevent nested sub-shells.
216+
217+ ## Configuration files
218+
219+ ### Kee configuration (` ~/.aws/kee.json ` )
220+
221+ ``` json
222+ {
223+ "accounts" : {
224+ "mycompany-prod" : {
225+ "profile_name" : " mycompany.dev" ,
226+ "sso_start_url" : " https://mycompany.awsapps.com/start" ,
227+ "sso_region" : " ap-southeast-2" ,
228+ "sso_account_id" : " 123456789012" ,
229+ "sso_role_name" : " AdministratorAccess" ,
230+ "session_name" : " mycompany.dev"
231+ }
232+ },
233+ "current_account" : null
234+ }
131235```
132236
133- ## Performance benchmarks
237+ ### AWS config ( ` ~/.aws/config ` )
134238
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 |
239+ ``` ini
240+ [profile mycompany.dev]
241+ sso_role_name = AdministratorAccess
242+ sso_session = mycompany
243+ sso_account_id = 123456789098
244+ output = json
245+
246+ [sso-session mycompany]
247+ sso_region = ap-southeast-2
248+ sso_start_url = https://mycompany.awsapps.com/start
249+ sso_registration_scopes = sso:account:access
250+ ```
141251
142252## Cross-platform support
143253
144- ** Identical support across: **
254+ ` Kee ` works on:
145255
146256- ** macOS** : Full support with shell prompt integration
147257- ** Linux** : Full support with shell prompt integration
148258- ** Windows** : Full support (prompt integration not available)
149259
150- ** Platform-specific optimizations:**
260+ ## Troubleshooting
261+
262+ ### SSO login issues
151263
152- - ** Windows** : Uses ` COMSPEC ` for shell detection
153- - ** Unix** : Uses ` SHELL ` environment variable
154- - ** All** : Proper path handling with ` std::path `
264+ If SSO login fails:
155265
156- ## Migration from the Python version
266+ ``` bash
267+ # Manual SSO login
268+ aws sso login --profile < account_name>
157269
158- ** Zero migration required:**
270+ # Then try using again
271+ kee use < account_name>
272+ ```
159273
160- - Same configuration files (` ~/.aws/kee.json ` )
161- - Same AWS config format
162- - Same command-line interface
163- - Same environment variables
274+ ### Profile not found
164275
165- ** Drop-in Replacement: **
276+ If you get "profile not found" errors:
166277
167278``` bash
168- # Remove the Python version
169- rm /usr/local/bin/kee
279+ # Check AWS config
280+ cat ~ /.aws/config
170281
171- # Or via Pip
172- pip uninstall kee
282+ # Re-add the account if needed
283+ kee remove < account_name>
284+ kee add < account_name>
285+ ```
286+
287+ ### Permission issues
288+
289+ If you get permission errors:
290+
291+ ``` bash
292+ # Check AWS credentials
293+ aws sts get-caller-identity --profile < account_name>
173294
174- # Install Rust version
175- cargo install --path . --force
295+ # Refresh SSO login
296+ aws sso login --profile < account_name >
176297```
177298
178- ## Future enhancements (specific to Rust)
299+ ## Future enhancements
179300
180301- ** Async AWS API calls** for faster credential validation
181302- ** Parallel account operations** for bulk management
@@ -184,8 +305,6 @@ cargo install --path . --force
184305- ** Plugin system** with dynamic loading
185306- ** TUI interface** with real-time updates
186307
187- ## Distribution
188-
189308** Binary distribution:**
190309
191310- Single executable file
@@ -195,25 +314,19 @@ cargo install --path . --force
195314
196315** Package managers:**
197316
198- - ** Cargo** : ` cargo install kee `
317+ - ** Cargo** : ` cargo install kee ` (when published)
199318- ** Homebrew** : ` brew install kee ` (when published)
200319- ** Scoop** : ` scoop install kee ` (Windows, when published)
201- - ** APT/YUM** : Native packages possible
320+ - ** APT/YUM** : Native packages possible (when published)
202321
203322## Contributing
204323
205- Same contribution guidelines as Python version, plus:
206-
2073241 . Fork the repository
2083252 . Create a feature branch
2093263 . Make your changes
210- 4 . Add tests if applicable
211- 5 . Submit a pull request
212-
213- ** Rust-specific:**
214-
215- - Follow ` rustfmt ` formatting
216- - Pass ` clippy ` lints
327+ 4 . Add tests, if applicable
328+ 5 . Test your changes: ` make test `
329+ 6 . Submit a pull request
217330
218331> There is a utilities script which will set up a ` pre-commit ` hook to run some basic checks on your code before you commit.
219332
0 commit comments