Sets up autocomplete for switching based on your ~/.aws/credentials
file.
Note: you'll need jq
installed, brew install jq
should do it.
- Create a new typescript project, and copy the
parse-credential-file.ts
file into it
npm init --y && npm i yargs typescript && npm i -D @types/node @types/yargs && npx tsc --init
- Compile the ts file using
ncc
eg.
npx @vercel/ncc build parse-credential-file.ts -o build/
(The reason Im using ncc
is that it allows you to move the compiled JS file into another directory without having to worry about dependencies - max portability!)
-
Update the bashrc script above with the build path (line 11)
-
Source your bash_profile/bashrc, eg.
source ~/.bash_profile
to pick up your changes -
Try it out! Type
aws_switch_profile <TAB>
in a shell.