with-aws-creds

Seed project for TypeScript projects

Usage no npm install needed!

<script type="module">
  import withAwsCreds from 'https://cdn.skypack.dev/with-aws-creds';
</script>

README

with-aws-creds

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

Usage

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 then when you want to execute a command which has command line arguments in quotes, set the whole command in apostrophs:

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 clearly differntiate between the command and the arguments. Using it is optional, but it makes more clear what are the arguments and what is the command.

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

For detailed documentation see the TypeDocs documentation.