CLI tool to retrieve or set AWS SSO credentials.
npm install get-sso-credsCLI tool to get AWS SSO temporary credentials.


In order for get-sso-creds to work properly AWS CLI v2 must be installed beforehand.
AWS CLI v2
``sh-session`
npm install -g get-sso-creds
> When developing application or scripts locally, AWS SDKs like the JavaScript aws-sdk or Python boto3 will load credentials either from environment variables or the ~/.aws/credentials file. This tool was designed to make that experience less of a hassle by allowing the user to either decide to export credentials as environment variables or by storing them in the ~/.aws/credentials file as either default or as any given profile name.
---
> Will write credentials to ~/.aws/credentials as [default]
`sh-session`
gscreds select -c
> Will write credentials to ~/.aws/credentials as [helloworld]
`sh-session`
gscreds select -c --set-as="helloworld"
> Will write credentials as export statements to your clipboard which you can simply paste into your shell and press enter.
`sh-session`
gscreds select -b
> Uses credentials from the "default" profile to assume the role "arn:aws:iam::996942091142:role/test-role" with default values for session-name etc. (Review assume documentation to see default values).
`sh-session`
gscreds assume --role="arn:aws:iam::996942091142:role/test-role"
> Uses credentials from the "dev" profile to assume the role "arn:aws:iam::996942091142:role/test-role" then sets those newly assumed credentials as the profile [helloworld] in "~/.aws/credentials".
`sh-session`
gscreds assume --role="arn:aws:iam::996942091142:role/test-role" --profile="dev" -c --set-as="helloworld"
* gscreds assume
* gscreds clear
* gscreds console
* gscreds get
* gscreds login
* gscreds logout
* gscreds ls
* gscreds select
Assumes AWS Role.
`
USAGE
$ gscreds assume [--help] [--json] [-n
FLAGS
-b, --clipboard Writes credentials to clipboard.
-c, --credentials Writes credentials to ~/.aws/credentials (will use [default] as the profile name if
--set-as flag is not used).
-n, --set-as=
-p, --profile=
-r, --role=
-s, --session-name=
--help Show CLI help.
--json Outputs credentials in json format.
DESCRIPTION
Assumes AWS Role.
EXAMPLES
$ gscreds assume --role arn:aws:iam::996942091142:role/test-role
$ gscreds assume --role arn:aws:iam::996942091142:role/test-role -c --set-as 'my-profile'
`
_See code: dist/commands/assume.ts_
Clears selected credentials in ~/.aws/credentials.
`
USAGE
$ gscreds clear [--help]
FLAGS
--help Show CLI help.
DESCRIPTION
Clears selected credentials in ~/.aws/credentials.
EXAMPLES
$ gscreds clear
? Select a profile: (Use arrow keys)
❯ default
personal
`
_See code: dist/commands/clear.ts_
Opens AWS Console for a selected profile.
`
USAGE
$ gscreds console [--help] [-b chrome|firefox|edge]
FLAGS
-b, --browser=
Suggested values: ["chrome", "firefox", "edge"]
--help Show CLI help.
DESCRIPTION
Opens AWS Console for a selected profile.
EXAMPLES
$ gscreds console
? Select a profile: (Use arrow keys)
❯ default
personal
`
_See code: dist/commands/console.ts_
Get AWS SSO credentials from existing profiles in ~/.aws/config.
`
USAGE
$ gscreds get [--help] [-P [-c | -b]] [--json]
FLAGS
-P, --preserve Sets selected profile name as the profile name in ~/.aws/credentials when using --credentials flag.
-b, --clipboard Writes credentials to clipboard.
-c, --credentials Writes credentials to ~/.aws/credentials (will use default as the profile name if --preserve flag
is not used).
--help Show CLI help.
--json Outputs credentials in json format.
DESCRIPTION
Get AWS SSO credentials from existing profiles in ~/.aws/config.
EXAMPLES
$ gscreds get
? Select a profile: (Use arrow keys)
❯ default
dev
prod
personal
Profile: my-profile
Credentials expire at: 6:20:24 PM
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_SESSION_TOKEN=
`
_See code: dist/commands/get.ts_
Initiates AWS SSO login.
`
USAGE
$ gscreds login [--help] [-p
FLAGS
-p, --profile=
--help Show CLI help.
DESCRIPTION
Initiates AWS SSO login.
EXAMPLES
$ gscreds login --profile your-profile
Logging in... ⣽
`
_See code: dist/commands/login.ts_
Initiates AWS SSO logout.
`
USAGE
$ gscreds logout [--help] [-p
FLAGS
-p, --profile=
--help Show CLI help.
DESCRIPTION
Initiates AWS SSO logout.
EXAMPLES
$ gscreds logout --profile your-profile
Logging out... ⣽
`
_See code: dist/commands/logout.ts_
Lists profile names in ~/.aws/config or ~/.aws/credentials.
`
USAGE
$ gscreds ls [--help]
FLAGS
--help Show CLI help.
DESCRIPTION
Lists profile names in ~/.aws/config or ~/.aws/credentials.
EXAMPLES
$ gscreds ls
? Select a file: (Use arrow keys)
❯ config
credentials
`
_See code: dist/commands/ls.ts_
Get AWS SSO credentials via AWS SSO.
`
USAGE
$ gscreds select [--help] [--json] [-n
FLAGS
-b, --clipboard Writes credentials to clipboard.
-c, --credentials Writes credentials to ~/.aws/credentials (will use [default] as the profile name if --set-as
flag is not used).
-n, --set-as=
-p, --profile=
--help Show CLI help.
--json Outputs credentials in json format.
DESCRIPTION
Get AWS SSO credentials via AWS SSO.
EXAMPLES
$ gscreds select
? Select an SSO url: (Use arrow keys)
❯ https://alpha.awsapps.com/start
https://delta.awsapps.com/start
? Select an SSO account:
❯ Log archive | ctlogs@google.com | 111111111111
test-alpha | testalpha@yahoo.com | 222222222222
? Select an SSO role: (Use arrow keys)
❯ AWSServiceCatalogEndUserAccess
AWSAdministratorAccess
...
``
_See code: dist/commands/select.ts_