Create an IAM user with programmatic access. Set the policies for the resources the Serverless app will require.
- Install "serverless" globally. Note that if you are using nvm it will only be installed on the current version:
npm i -g serverless
- Configure Serverless to your AWS IAM user:
sls config credentials --provider aws --key YOUR_ACCESS_KEY --secret YOUR_SECRET_KEY --profile serverless-user
This will add an IAM profile to your ~/aws/credentials
file with your access key and secret key.
- List the available sls (serverless) templates:
sls create --template
- Create your sls project (the default region is "us-east-1"):
sls create --template aws-nodejs-typescript --path project-folder-path
To deploy:
sls deploy -v
If you get a permissions error when you run deploy you may need to specify the user profile
sls deploy -v --aws-profile serverless-user
Delete handler file generated by SLS.
npm i aws-sdk --save-dev