Search code examples
node.jsnpmamazon-cloudfrontserverless-frameworkaws-serverless

Setting AWS credentials in serverless framework when it is installed as a dev dependency


I have installed the serverless framework as a dev dependency using:

npm -i --save-dev serverless

I have also set sls:sls in the scripts in package.json

Now sls works, meaning that I can run it by typing "npm run sls". I want to set my AWS credentials so by writing.

npm run sls config credentials --provider aws, --key XXXXXX, --secret XXXXXXXXXXXXXXXXXXX

but it does not work, could you please help me with this?

Thank you in advance.


Solution

  • Parameters can be passed to run-script commands using --

    You can try npm run sls -- config credentials --provider aws, --key XXXXXX, --secret XXXXXXXXXXXXXXXXXXX

    For more details checkout this answer https://stackoverflow.com/a/44743871/5798816