Boilerplate for running serverless framework on docker
cp .env.example .env
Update .env
file using your AWS credentials
./app build
./app [COMMAND]
Create a new app base on a templates, aws-nodejs
is the nodejs
template for aws serverless
You can use different templates based on your language of preference and your cloud environment
./app sls create -t aws-nodejs
./app
Docker commands:
build Build the docker container
config Split out the docker-conpose file used
rm [PARAMS] Remove docker containers, add -v to remove volumes also
down [PARAMS] Stop and remove containers and networks, extra params:
-v to remove volumes
--rmi type [local, all] to remove images
Development commands:
connect Login to docker shell interface
npm [COMMAND] Run npm commands inside the docker container
sls [COMMAND] Run a serverless command inside doker
invoke [-f FUNCTION] Invoke a local serverless function
deploy Deploy to your sandbox
Serverless credentials docs: (https://serverless.com/framework/docs/providers/aws/guide/credentials/)
- Create a aws user
- Create aws policies if required
- Attach polices to user directly or assign user to a group with existing polices
- Goto
security credentials
tab and create an access key - Update
.env
file with your AWS credentials
If your credentials are setup correctly then run:
./app sls deploy
and your app will be packed and deploy to the right enviroment base on serverless.yml
Plugins to consider:
plugins:
- serverless-pseudo-parameters