When logging into the commandline using Control Tower, you typically need to click the copy button, open your credentials file, paste the contents in the appropriate location, and then potentially change the profile name.
pcreds is a simple commandline utility to do all of these things with one command.
pcreds:
- Reads a credentials profile from the clipboard
- Parses the profile name and looks up an alias in pcreds.yaml (stored in your .aws folder)
- Parses your credentials file, updates the corresponding profile and saves an updated version
Install Go from the official website
clone this repository and build the executable. Then move it to your bin folder
git clone https://github.com/DaraDadachanji/pcreds.git
cd pcreds
go mod tidy
go build
mv ./pcreds /usr/local/bin/pcreds
You may create a pcreds.yaml file in ~/.aws
to store aliases for your profiles
profiles:
123456789012_My-Profile: default
123456789012_My-Dev-Profile: usdev
987654321098_My-Profile: euprod
987654321098_My-Dev-Profile: eudev
The key should be the profile name generated by SSO while the value should be your preferred alias for it.
This step is optional
simply copy the value from the SSO browser window
and then run pcreds
in your terminal