Serverless - Useful commands

Useful command for serverless framework

Install Serverless

npm install -g serverless

Create app eg: Nodejs

serverless create --template aws-nodejs --path my-service

config credentials

serverless config credentials --provider <PROVIDER> --key <KEY> --secret <SECRET> --profile <PROFILE>
serverless config credentials --provider aws --key AKIAIOSFODNN7EXAMPLE --secret wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY --profile your-name #eg

dev server(serverless-offline)

sls offline start --stage <STAGE_NAME>
sls offline start --stage <dev> #eg

Deploy

sls deploy --stage <STAGE_NAME>
sls deploy --stage prod #eg

Deploy with spefied profile

export AWS_PROFILE=XXXXX && sls offline start --stage <STAGE_NAME>
export AWS_PROFILE=XXXXX && sls offline start --stage prod #eg