North Pittsburgh Meatpackers

    TypeScript icon, indicating that this package has built-in type declarations

    1.3.0 • Public • Published


    Downloads Version@npm Version@git CI Docs

    A CLI tool to run a command with your AWS credentials set as environment variables.

    The tool will set ALL key/values from the selected profile from the AWS Credentials file as environment variables, where:

    1. The environment variable names are in UPPERCASE
    2. The profile selected is either
      1. the one set in the --aws_profile argument, or
      2. the one set in the AWS_PROFILE environment variable, or
      3. the default, or
      4. if non-match, and there is only one profile, then that.


    Install the tool globally:

    npm install -g with-aws-creds

    Use the with-aws-creds command to execute any commands:

    with-aws-creds yarn test

    Note that when you want to execute a command which has command-line arguments in quotes, set the whole command in apostrophes:

    with-aws-creds "node -e \"console.log(process.env.AWS_ACCESS_KEY_ID)\""

    Additional properties

    If you would like to set additional temporary environment variables to your command, set them right before your command as command-line arguments with values:

    with-aws-creds --aws_account_id=123 -- "node -e \"console.log(process.env.AWS_ACCOUNT_ID)\""
    # or
    # with-aws-creds --aws_account_id 123 -- "node -e \"console.log(process.env.AWS_ACCOUNT_ID)\""

    You can also use the -- separator argument to differentiate between the command and the arguments. Using it is optional, but it makes clear, which is the command and where arguments start.

    Important! ensure that all parameters you set have a value!

    Note that arguments can be set using either underscore (_) or dash (-) instead of white spaces, e.g. --aws-profile.


    The tool also allows using AWS STS to assume a given role and use the credentials during command execution. To assume a role and use that, you can use the following command:

    with-aws-creds --aws_role=arn-of-the-role -- "node -e \"console.log(process.env.AWS_ACCESS_KEY_ID)\""

    If the aws_role argument is set, then the tool will use the default credentials set on the host machine and will assume the role passed. If the action is successful, then the generated AWS credentials will be set in the environment variables.


    For detailed documentation see the TypeDocs documentation.


    npm i with-aws-creds

    DownloadsWeekly Downloads






    Unpacked Size

    15.9 kB

    Total Files


    Last publish


    • szikszail