README
with-aws-creds
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:
- The environment variable names are in UPPERCASE
- The profile selected is either
- the one set in the
--aws_profile
argument, or - the one set in the
AWS_PROFILE
environment variable, or - the
default
, or - if non match, and there is only one profile, then that.
- the one set in the
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.