switch-profile 1.1.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +197 -94
- package/dist/cli.js +7921 -0
- package/index.js +12 -409
- package/package.json +31 -25
- package/.eslintrc.json +0 -39
- package/CHANGELOG.md +0 -120
- package/docs/architecture.md +0 -199
- package/docs/aws-profile-management.md +0 -325
- package/docs/cli-interface.md +0 -304
- package/docs/configuration-files.md +0 -240
- package/docs/development-guide.md +0 -168
- package/docs/gotchas.md +0 -82
- package/skills-lock.json +0 -73
- package/src/aws/index.js +0 -574
- package/src/aws/regions.js +0 -103
- package/src/core.js +0 -64
- package/src/fileHelper.js +0 -433
package/README.md
CHANGED
|
@@ -1,163 +1,266 @@
|
|
|
1
1
|
# switch-profile
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center"><img src="docs/images/hero.webp" width="100%" alt="switch-profile illustration: a girl rides a rope lift up a tower of lit workshops"></p>
|
|
4
|
+
|
|
5
|
+
**Jump between AWS accounts from your terminal in seconds, the way AWS recommends.**
|
|
6
|
+
|
|
7
|
+
If you work across many AWS accounts (clients, environments, organizations), you switch accounts dozens of times a day. `switch-profile` turns that into a few keystrokes: type part of a name, account ID or client, press Enter, and every AWS tool in that terminal is on the right account, logged in and verified. It works the same on your laptop and on a remote machine over SSH, and it never asks you to manage access keys.
|
|
4
8
|
|
|
5
9
|
```shell
|
|
6
10
|
npx switch-profile
|
|
7
11
|
```
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
```
|
|
14
|
+
┌ switch-profile 2.0.0
|
|
15
|
+
│
|
|
16
|
+
│ ● acme-prod · Admin · 111111111111 · ap-southeast-2 · PROD · SSO ✓ auto-refresh · logged in 3h ago
|
|
17
|
+
│
|
|
18
|
+
◆ Switch to · type a name, account, role or client
|
|
19
|
+
│ Search: dev▌
|
|
20
|
+
│ ● acme-dev Admin 222222222222 ap-southeast-2 (used 2d ago)
|
|
21
|
+
│ ○ globex-dev ReadOnly 333333333333 us-east-1
|
|
22
|
+
│ ○ initech-dev Admin 444444444444 eu-west-1
|
|
23
|
+
└
|
|
24
|
+
```
|
|
10
25
|
|
|
11
|
-
|
|
26
|
+
## Why it's great
|
|
27
|
+
|
|
28
|
+
- **Seconds, not minutes.** Fuzzy search across profile name, account ID, account name, role, client and region, with your most-used accounts first. `sp acme prod` switches without even opening the picker.
|
|
29
|
+
- **Logged in when you need it.** If a session has expired, it logs you in on the spot, then never again until the session ends: credentials refresh on their own in the AWS CLI, SDKs and Terraform.
|
|
30
|
+
- **Every terminal on its own account.** With the `sp` shortcut, each terminal keeps its own `AWS_PROFILE`, plus tab-completion of your profile names.
|
|
31
|
+
- **Made for remote machines.** On a server reached over SSH, the login code lands in your laptop's clipboard, or scan a QR code with your phone.
|
|
32
|
+
- **A whole client in one step.** `sp add` creates a profile for every account and role in an IAM Identity Center portal, and re-syncs it later.
|
|
33
|
+
- **Scripts and AI agents welcome.** It never prompts without a terminal, offers `--json` output and stable exit codes.
|
|
34
|
+
|
|
35
|
+
## Built on AWS best practices
|
|
36
|
+
|
|
37
|
+
`switch-profile` does not invent its own security model. It follows what AWS recommends, lets the official AWS CLI do the sensitive work, and adds the guardrails that make switching accounts all day safe.
|
|
38
|
+
|
|
39
|
+
- **Temporary credentials, not access keys.** AWS recommends that people sign in through an identity provider, such as IAM Identity Center (AWS SSO), and use short-lived credentials instead of long-lived access keys ([IAM best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)). `switch-profile` is built around SSO and console sign-in (`aws login`). Access keys still work, but it warns you before creating new ones.
|
|
40
|
+
- **It never copies credentials.** Switching writes only a profile's *settings* into `[default]`. The AWS CLI and SDKs fetch short-lived credentials themselves and refresh them through `[sso-session]` ([AWS CLI SSO guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html)). There are no secrets in anything `switch-profile` writes, so nothing to leak and nothing to go stale.
|
|
41
|
+
- **The AWS CLI does the logging in.** Logins run through `aws sso login` and `aws login`: browser sign-in on your machine, device code where there is no browser. `switch-profile` stores no tokens and has no telemetry. Its only network calls are the AWS CLI's own and npx fetching the package.
|
|
42
|
+
- **Device codes, handled carefully.** Device-code approvals are a known phishing route, so they are used only where there is no browser, and the login screen tells you to approve only the exact code it shows.
|
|
43
|
+
- **You always know which account you are in.** Every switch confirms the real identity with `aws sts get-caller-identity`. Production accounts are flagged in red. Environment variables that would silently override your choice (such as `AWS_ACCESS_KEY_ID`) are flagged, and `sp` clears them.
|
|
44
|
+
- **One account per terminal.** `AWS_PROFILE` is scoped to a terminal, so switching in one window cannot move a deploy running in another.
|
|
45
|
+
- **Careful with your files.** Edits to `~/.aws` are atomic, upgrades back up your files first, and the shell setup lives in one clearly marked block that you can remove from Settings at any time.
|
|
46
|
+
- **Always the latest version.** Run through `npx`, every run uses the newest release: nothing to install, nothing to update.
|
|
47
|
+
|
|
48
|
+
## Table of Contents
|
|
49
|
+
|
|
50
|
+
<!-- BEGIN toc -->
|
|
51
|
+
- [Why it's great](#why-its-great)
|
|
52
|
+
- [Built on AWS best practices](#built-on-aws-best-practices)
|
|
53
|
+
- [Quick start](#quick-start)
|
|
54
|
+
- [Commands](#commands)
|
|
55
|
+
- [Working on remote machines (SSH)](#working-on-remote-machines-ssh)
|
|
56
|
+
- [Importing a client's accounts](#importing-a-clients-accounts)
|
|
57
|
+
- [Scripts and AI agents](#scripts-and-ai-agents)
|
|
58
|
+
- [Settings](#settings)
|
|
59
|
+
- [The `sp` shortcut](#the-sp-shortcut)
|
|
60
|
+
- [Upgrading from 1.x](#upgrading-from-1x)
|
|
61
|
+
- [Requirements](#requirements)
|
|
62
|
+
- [Troubleshooting](#troubleshooting)
|
|
63
|
+
- [`invalid_grant` during an SSO login](#invalid_grant-during-an-sso-login)
|
|
64
|
+
- [`Error loading SSO Token` or "session has expired"](#error-loading-sso-token-or-session-has-expired)
|
|
65
|
+
- [SSO login hangs on a remote machine](#sso-login-hangs-on-a-remote-machine)
|
|
66
|
+
- [The code is not in my clipboard over SSH](#the-code-is-not-in-my-clipboard-over-ssh)
|
|
67
|
+
- [`sp: command not found`](#sp-command-not-found)
|
|
68
|
+
- [Tab-completion does not work in zsh](#tab-completion-does-not-work-in-zsh)
|
|
69
|
+
- [Commands still use the wrong account](#commands-still-use-the-wrong-account)
|
|
70
|
+
- [AWS CLI not found](#aws-cli-not-found)
|
|
71
|
+
- [Documentation](#documentation)
|
|
72
|
+
- [License](#license)
|
|
73
|
+
<!-- END toc -->
|
|
74
|
+
|
|
75
|
+
## Quick start
|
|
12
76
|
|
|
13
|
-
|
|
14
|
-
|
|
77
|
+
```shell
|
|
78
|
+
npx switch-profile
|
|
79
|
+
```
|
|
15
80
|
|
|
16
|
-
`switch-profile`
|
|
81
|
+
On the first switch, `switch-profile` offers to set up the `sp` shortcut (a small function in your shell startup file). Say yes, open a new terminal, and from then on:
|
|
17
82
|
|
|
18
|
-
|
|
83
|
+
```shell
|
|
84
|
+
sp # pick a profile
|
|
85
|
+
sp acme-prod # switch straight to a profile
|
|
86
|
+
sp acme prod # fuzzy match: switches if exactly one profile matches
|
|
87
|
+
```
|
|
19
88
|
|
|
20
|
-
-
|
|
21
|
-
- **Node.js** - Any recent version that supports `npx`.
|
|
89
|
+
**Why npx?** It always runs the latest release, so you never have to update anything. `sp` uses `npx switch-profile@latest` under the hood. The cost is a second or two while npm checks for a newer version, and the tool needs a connection to AWS anyway. A global install (`npm install -g switch-profile`) also works, but then updating is up to you, and `sp` keeps using npx regardless.
|
|
22
90
|
|
|
23
|
-
|
|
24
|
-
> - `AWS_ACCESS_KEY_ID`
|
|
25
|
-
> - `AWS_SECRET_ACCESS_KEY`
|
|
26
|
-
> - `AWS_SESSION_TOKEN`
|
|
91
|
+
No profiles yet? `switch-profile` starts the **Add profiles** flow. To import every account of your company's or client's SSO portal, see [Importing a client's accounts](#importing-a-clients-accounts).
|
|
27
92
|
|
|
28
|
-
##
|
|
93
|
+
## Commands
|
|
29
94
|
|
|
30
|
-
|
|
95
|
+
| Command | What it does |
|
|
96
|
+
|---------|--------------|
|
|
97
|
+
| `switch-profile [profile...]` | Opens the picker. With words: an exact name or a unique fuzzy match switches directly; otherwise the picker opens pre-filtered (or exits 3 when non-interactive). |
|
|
98
|
+
| `use <profile>` | Switches to a profile by its exact name (no fuzzy matching). |
|
|
99
|
+
| `status [--json]` | Shows the default profile, its login state, and what this terminal uses. |
|
|
100
|
+
| `login [profile] [--device\|--browser]` | Starts a fresh login now, even if the session is still valid. Defaults to this terminal's `AWS_PROFILE`, then the default profile. |
|
|
101
|
+
| `logout [--yes]` | Ends every SSO session on this machine (`aws sso logout`, plus `aws logout --all` on AWS CLI 2.32+). |
|
|
102
|
+
| `add` | Adds profiles: import accounts from an SSO portal (recommended), a single SSO profile, a console sign-in profile, or access keys. |
|
|
103
|
+
| `add --from-sso [session]` | Imports or re-syncs every account and role of an `[sso-session]`. Options: `--region`, `--prefix`, `--prune`, `--yes`. |
|
|
104
|
+
| `remove [profiles...] [--yes]` | Removes profiles (alias `rm`). The current default cannot be removed. |
|
|
105
|
+
| `settings` | Per-terminal switching, SSO login mode, legacy SSO upgrade. |
|
|
106
|
+
|
|
107
|
+
Global options: `--json`, `--no-input` (never prompt), `--debug` (show stack traces), `-v, --version`. In examples, `sp` and `switch-profile` are interchangeable; only `sp` changes the current terminal.
|
|
108
|
+
|
|
109
|
+
See [CLI Interface](docs/cli-interface.md) for every screen.
|
|
110
|
+
|
|
111
|
+
## Working on remote machines (SSH)
|
|
112
|
+
|
|
113
|
+
Since AWS CLI 2.22, `aws sso login` opens a browser on the machine running the CLI. Over SSH there is none, so the login hangs. `switch-profile` detects remote sessions (`SSH_CONNECTION`, `SSH_CLIENT` or `SSH_TTY` set, or Linux without `DISPLAY`/`WAYLAND_DISPLAY`) and uses a device code instead:
|
|
31
114
|
|
|
32
|
-
```shell
|
|
33
|
-
npx switch-profile
|
|
34
115
|
```
|
|
116
|
+
◇ Approve the login for acme
|
|
35
117
|
|
|
36
|
-
|
|
118
|
+
Open https://device.sso.us-east-1.amazonaws.com/?user_code=WXYZ-ABCD
|
|
119
|
+
Code WXYZ-ABCD 📋 sent to your clipboard
|
|
37
120
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
121
|
+
🔒 Only approve if the page shows exactly this code.
|
|
122
|
+
q QR code · c copy again · ctrl+c cancel
|
|
123
|
+
◒ Waiting for approval 0:12
|
|
41
124
|
```
|
|
42
125
|
|
|
43
|
-
|
|
126
|
+
- **Clipboard over SSH.** The code is sent to your local clipboard with the OSC 52 terminal escape sequence. iTerm2, Ghostty, kitty, WezTerm and Windows Terminal support it; tmux needs `set -g set-clipboard on` (or `allow-passthrough on`). If your terminal ignores it, copy the code by hand.
|
|
127
|
+
- **QR code.** Press `q` to show the URL as a QR code and approve from your phone.
|
|
128
|
+
- **Log in any time.** `sp login` starts a fresh session now, for example before a long task. `--device` and `--browser` override the automatic choice; Settings can make either permanent.
|
|
129
|
+
- **Log out.** `sp logout` ends every SSO session on the machine, so a shared or rented server keeps no AWS access.
|
|
130
|
+
|
|
131
|
+
How often you log in is set by IAM Identity Center, not by `switch-profile`:
|
|
44
132
|
|
|
45
|
-
|
|
133
|
+
- The **user interactive session** duration decides when you must log in again. The default is 8 hours, up to 90 days. Your administrator sets it once for the whole Identity Center instance (Settings > Authentication).
|
|
134
|
+
- The **permission set** session duration (1 to 12 hours) matters less: role credentials refresh automatically while the SSO session is valid, as long as the profile uses an `[sso-session]` (the format `switch-profile` writes).
|
|
135
|
+
|
|
136
|
+
## Importing a client's accounts
|
|
46
137
|
|
|
47
138
|
```shell
|
|
48
|
-
|
|
139
|
+
sp add # then choose "Accounts from an SSO portal"
|
|
49
140
|
```
|
|
50
141
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
4. Display an `export AWS_PROFILE=<name>` command you can run to lock that profile to your current terminal session.
|
|
142
|
+
1. Pick an existing `[sso-session]` or create one: start URL (e.g. `https://acme.awsapps.com/start`), SSO region (where Identity Center lives, not where you deploy), and a short name, usually the client.
|
|
143
|
+
2. Log in if needed.
|
|
144
|
+
3. `switch-profile` lists every account and role you can access, then asks for a default region and a name prefix. Profiles are named `<prefix>-<account-name>-<role>`, for example `acme-prod-workloads-admin`.
|
|
145
|
+
4. A preview shows the new profiles, the ones already set up, and the ones that no longer exist. Confirm to write them.
|
|
56
146
|
|
|
57
|
-
|
|
147
|
+
Run it again later to pick up new accounts. Account/role pairs that already have a profile are never duplicated, whatever its name. Generated profiles that no longer exist can be pruned (after a backup); profiles you wrote by hand are never pruned.
|
|
58
148
|
|
|
59
|
-
|
|
149
|
+
Non-interactive (after `aws sso login --sso-session acme` or `sp login`):
|
|
60
150
|
|
|
61
151
|
```shell
|
|
62
|
-
|
|
63
|
-
# Select "More options" > "Create profile"
|
|
152
|
+
switch-profile add --from-sso acme --region eu-west-1 --prefix acme --yes --json
|
|
64
153
|
```
|
|
65
154
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
155
|
+
## Scripts and AI agents
|
|
156
|
+
|
|
157
|
+
`switch-profile` never prompts when stdin or stdout is not a terminal, when `CI` is set, or with `--no-input`. It fails with a hint and an exit code instead.
|
|
158
|
+
|
|
159
|
+
| Exit code | Meaning |
|
|
160
|
+
|-----------|---------|
|
|
161
|
+
| 0 | OK |
|
|
162
|
+
| 1 | Error |
|
|
163
|
+
| 2 | Login required (run `switch-profile login <profile>` in a terminal) |
|
|
164
|
+
| 3 | Bad input: unknown or ambiguous profile, missing argument or `--yes` |
|
|
165
|
+
| 130 | Cancelled |
|
|
69
166
|
|
|
70
|
-
|
|
167
|
+
- `--json` prints machine-readable results on stdout. Expected errors are printed as JSON on stderr: `{"error": "...", "hint": "...", "code": 3}`.
|
|
168
|
+
- `switch-profile status --json` lists every profile with its kind, account, role, region and whether it is production.
|
|
169
|
+
- Non-interactive logins still work: `switch-profile login acme-dev --device` prints the AWS CLI's URL and code on stderr and waits for approval.
|
|
170
|
+
- A shell tool's environment does not survive between commands, so `sp` and `export AWS_PROFILE` do not help an agent. Prefix each AWS command instead:
|
|
71
171
|
|
|
72
172
|
```shell
|
|
73
|
-
|
|
74
|
-
|
|
173
|
+
AWS_PROFILE=acme-dev aws s3 ls
|
|
174
|
+
AWS_PROFILE=acme-dev terraform plan
|
|
75
175
|
```
|
|
76
176
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
### Refresh an expired profile
|
|
177
|
+
## Settings
|
|
80
178
|
|
|
81
179
|
```shell
|
|
82
|
-
|
|
83
|
-
# Select "More options" > "Refresh default profile"
|
|
180
|
+
sp settings
|
|
84
181
|
```
|
|
85
182
|
|
|
86
|
-
|
|
183
|
+
- **Per-terminal switching**: turns the `sp` shortcut (and tab-completion) on or off.
|
|
184
|
+
- **SSO login**: `auto` (device code over SSH, browser otherwise), always device code, or always browser.
|
|
185
|
+
- **Legacy SSO profiles**: upgrades SSO profiles that have no `[sso-session]` (no auto-refresh).
|
|
186
|
+
|
|
187
|
+
The tool's own state lives in `~/.switch-profile/settings.json`. See [Configuration Files](docs/configuration-files.md).
|
|
87
188
|
|
|
88
|
-
|
|
189
|
+
### The `sp` shortcut
|
|
89
190
|
|
|
90
|
-
`switch-profile`
|
|
191
|
+
`sp` is a shell function added to your startup file inside a `# >>> switch-profile ... >>>` block. It runs `switch-profile`, then sets `AWS_PROFILE` in the current terminal and clears `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN` and `AWS_DEFAULT_PROFILE`, which would otherwise override the profile. It also completes profile names and subcommands with Tab. Do not edit the block: `switch-profile` rewrites it when a new version changes it.
|
|
91
192
|
|
|
92
|
-
|
|
|
93
|
-
|
|
94
|
-
|
|
|
95
|
-
|
|
|
193
|
+
| Shell | Startup file |
|
|
194
|
+
|-------|--------------|
|
|
195
|
+
| zsh | `${ZDOTDIR:-~}/.zshrc` |
|
|
196
|
+
| bash | `~/.bashrc` (Linux), `~/.bash_profile` (macOS) |
|
|
197
|
+
| fish | `~/.config/fish/config.fish` |
|
|
198
|
+
| PowerShell | `$PROFILE.CurrentUserAllHosts` (for `pwsh` and/or Windows PowerShell) |
|
|
96
199
|
|
|
97
|
-
|
|
98
|
-
1. Retrieves the credentials for that profile (from cache or via SSO login).
|
|
99
|
-
2. Writes them into the `[default]` section of both files.
|
|
100
|
-
3. Records the profile name and expiry date for status display.
|
|
101
|
-
4. Shows an `export AWS_PROFILE=<name>` command to optionally lock the profile to your terminal session.
|
|
200
|
+
## Upgrading from 1.x
|
|
102
201
|
|
|
103
|
-
|
|
202
|
+
Version 1.x copied temporary credentials into `[default]` of `~/.aws/credentials`, which expired after about an hour. Version 2 upgrades your setup automatically on its first run:
|
|
104
203
|
|
|
105
|
-
|
|
204
|
+
- `~/.aws/config` and `~/.aws/credentials` are backed up next to themselves (e.g. `~/.aws/config.bak-2026-10-01T10-12-00Z`).
|
|
205
|
+
- `[default]` is rewritten with the settings of the profile you last selected, and the 1.x `profile` and `expiry_date` keys are removed.
|
|
206
|
+
- If some SSO profiles use the legacy format (no `sso_session`), you are asked once whether to upgrade them. Profiles of the same portal share one session, so one login covers them all.
|
|
106
207
|
|
|
107
|
-
|
|
108
|
-
- `~/.aws/sso/cache/` - SSO session tokens (long-lived, ~24 hours)
|
|
109
|
-
- `~/.aws/cli/cache/` - Temporary AWS credentials (short-lived, ~1 hour)
|
|
208
|
+
The old `switch-profile switch` command still works. If you run 1.x again later (e.g. `npx switch-profile@1`), the next 2.x run repairs `[default]` (with backups).
|
|
110
209
|
|
|
111
|
-
##
|
|
210
|
+
## Requirements
|
|
112
211
|
|
|
113
|
-
|
|
212
|
+
- **Node.js 20.12 or later.** Older versions get a clear message.
|
|
213
|
+
- **[AWS CLI v2](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).** 2.22 or later is recommended (choice between device code and browser login); console sign-in (`aws login`) needs 2.32+.
|
|
214
|
+
- **macOS and Linux** are first-class (zsh, bash, fish). **Windows PowerShell** is supported. **CMD** is limited: no `sp`, so run the `set AWS_PROFILE=<name>` command shown after each switch.
|
|
114
215
|
|
|
115
|
-
|
|
116
|
-
|----------|-------------|
|
|
117
|
-
| [Architecture](docs/architecture.md) | Project structure, source files, and how the components fit together |
|
|
118
|
-
| [AWS Profile Management](docs/aws-profile-management.md) | How AWS profiles, SSO sessions, and credentials are managed internally |
|
|
119
|
-
| [CLI Interface](docs/cli-interface.md) | Detailed walkthrough of every menu, prompt, and user flow |
|
|
120
|
-
| [Configuration Files](docs/configuration-files.md) | Exact formats of all AWS and internal configuration files |
|
|
121
|
-
| [Development Guide](docs/development-guide.md) | How to set up, develop, test, lint, and release |
|
|
122
|
-
| [Gotchas](docs/gotchas.md) | Critical pitfalls — global profile switching, per-terminal isolation limits, and LLM agent constraints |
|
|
216
|
+
The published package has no runtime dependencies: everything is bundled into one file.
|
|
123
217
|
|
|
124
218
|
## Troubleshooting
|
|
125
219
|
|
|
126
|
-
### `invalid_grant
|
|
220
|
+
### `invalid_grant` during an SSO login
|
|
221
|
+
|
|
222
|
+
The SSO region is wrong. It must be the region of your IAM Identity Center instance, not the region you deploy to. Fix `sso_region` in the `[sso-session]` section of `~/.aws/config` (or remove the portal and add it again).
|
|
223
|
+
|
|
224
|
+
### `Error loading SSO Token` or "session has expired"
|
|
127
225
|
|
|
128
|
-
|
|
226
|
+
The SSO login is missing or expired. Run `sp login` (or just switch to the profile again: `switch-profile` logs in when needed). There is no need to recreate the profile.
|
|
129
227
|
|
|
130
|
-
|
|
228
|
+
### SSO login hangs on a remote machine
|
|
131
229
|
|
|
132
|
-
|
|
230
|
+
The AWS CLI is waiting for a browser on the remote machine. Run `sp login --device`, or set **Settings > SSO login** to always use a device code.
|
|
133
231
|
|
|
134
|
-
|
|
232
|
+
### The code is not in my clipboard over SSH
|
|
135
233
|
|
|
136
|
-
|
|
234
|
+
Your terminal does not accept OSC 52, or tmux blocks it. In tmux, add `set -g set-clipboard on` to `~/.tmux.conf`. Otherwise copy the code from the screen (press `c` to try again).
|
|
137
235
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
236
|
+
### `sp: command not found`
|
|
237
|
+
|
|
238
|
+
The terminal was opened before `sp` was set up. Open a new terminal or run `source ~/.zshrc` (or your shell's equivalent). `sp settings` shows whether it is on.
|
|
239
|
+
|
|
240
|
+
### Tab-completion does not work in zsh
|
|
241
|
+
|
|
242
|
+
The completion registers only if `compinit` ran before the `switch-profile` block. Move the block below `compinit` (or below the line that loads oh-my-zsh) in `~/.zshrc`.
|
|
243
|
+
|
|
244
|
+
### Commands still use the wrong account
|
|
245
|
+
|
|
246
|
+
`AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` in the environment override every profile, and `AWS_REGION` overrides the profile's region. The picker warns about them; switching with `sp` clears the credential variables (not the region).
|
|
142
247
|
|
|
143
248
|
### AWS CLI not found
|
|
144
249
|
|
|
145
|
-
`
|
|
250
|
+
**macOS:** `brew install awscli`
|
|
146
251
|
|
|
147
|
-
**
|
|
148
|
-
```shell
|
|
149
|
-
brew install awscli
|
|
150
|
-
brew link --overwrite awscli
|
|
151
|
-
```
|
|
252
|
+
**Linux and Windows:** follow the [AWS CLI install guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
|
|
152
253
|
|
|
153
|
-
|
|
154
|
-
```shell
|
|
155
|
-
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
|
156
|
-
unzip awscliv2.zip
|
|
157
|
-
sudo ./aws/install
|
|
158
|
-
```
|
|
254
|
+
## Documentation
|
|
159
255
|
|
|
160
|
-
|
|
256
|
+
<!-- BEGIN doc-index -->
|
|
257
|
+
- [Architecture](docs/architecture.md) — Module map, data flow and bundling of the switch-profile CLI.
|
|
258
|
+
- [AWS Profile Management](docs/aws-profile-management.md) — Profile kinds, switching, SSO logins, SSO import, migrations and the sp shell function.
|
|
259
|
+
- [CLI Interface](docs/cli-interface.md) — Walkthrough of every command and screen of the CLI.
|
|
260
|
+
- [Configuration Files](docs/configuration-files.md) — Exact formats of the AWS files, the settings file and the shell block written by switch-profile.
|
|
261
|
+
- [Development Guide](docs/development-guide.md) — Build, lint, tests, manual testing and releases.
|
|
262
|
+
- [Gotchas](docs/gotchas.md) — Non-obvious pitfalls for users and maintainers.
|
|
263
|
+
<!-- END doc-index -->
|
|
161
264
|
|
|
162
265
|
## License
|
|
163
266
|
|