npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

get-sso-creds

v6.4.3

Published

CLI tool to retrieve or set AWS SSO credentials.

Downloads

67

Readme

get-sso-creds

CLI tool to get AWS SSO temporary credentials.

Version License

Prerequisites

In order for get-sso-creds to work properly AWS CLI v2 must be installed beforehand.

AWS CLI v2

https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

Install

npm install -g get-sso-creds

Examples

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]

gscreds select -c

Will write credentials to ~/.aws/credentials as [helloworld]

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.

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).

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".

gscreds assume --role="arn:aws:iam::996942091142:role/test-role" --profile="dev" -c --set-as="helloworld"

Commands

gscreds assume

Assumes AWS Role.

USAGE
  $ gscreds assume [--help] [--json] [-n <value> [-c | -b]] (-s <value> -r <value>) [-p <value>]

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=<value>        Desired name of profile when setting credentials via --credentials flag.
  -p, --profile=<value>       [default: default] Desired SSO config profile to use.
  -r, --role=<value>          (required) ARN of the role to assume.
  -s, --session-name=<value>  [default: gscreds-session] Desired name for the role session.
  --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

gscreds clear

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

gscreds console

Opens AWS Console for a selected profile.

USAGE
  $ gscreds console [--help] [-b chrome|firefox|edge]

FLAGS
  -b, --browser=<option>  Opens designated browser over the system default.

                          Suggested values: ["chrome", "firefox", "edge"]
                          <options: 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

gscreds get

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=<AWS_ACCESS_KEY_ID>
  export AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY>
  export AWS_SESSION_TOKEN=<AWS_SESSION_TOKEN>

See code: dist/commands/get.ts

gscreds login

Initiates AWS SSO login.

USAGE
  $ gscreds login [--help] [-p <value>]

FLAGS
  -p, --profile=<value>  [default: default] Profile name to use for login.
  --help                 Show CLI help.

DESCRIPTION
  Initiates AWS SSO login.

EXAMPLES
  $ gscreds login --profile your-profile
  Logging in... ⣽

See code: dist/commands/login.ts

gscreds logout

Initiates AWS SSO logout.

USAGE
  $ gscreds logout [--help] [-p <value>]

FLAGS
  -p, --profile=<value>  [default: default] Profile name to use for logout.
  --help                 Show CLI help.

DESCRIPTION
  Initiates AWS SSO logout.

EXAMPLES
  $ gscreds logout --profile your-profile
  Logging out... ⣽

See code: dist/commands/logout.ts

gscreds ls

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

gscreds select

Get AWS SSO credentials via AWS SSO.

USAGE
  $ gscreds select [--help] [--json] [-n <value> [-c | -b]] [-p <value>]

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=<value>   Desired name of profile when setting credentials via --credentials flag.
  -p, --profile=<value>  [default: default] Desired SSO config profile to use.
  --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 | [email protected] | 111111111111
    test-alpha | [email protected] | 222222222222
  ? Select an SSO role: (Use arrow keys)
  ❯ AWSServiceCatalogEndUserAccess
    AWSAdministratorAccess
   ...

See code: dist/commands/select.ts