2.4 KiB
Quick Start
Pre-requisites
- Node.js
v6.5.0or later. - Serverless CLI
v1.9.0or later. You can runnpm install -g serverlessto install it. - An AWS account. If you don't already have one, you can sign up for a free trial that includes 1 million free Lambda requests per month.
- Set-up your Provider Credentials. Watch the video on setting up credentials
Tutorials
Check out the following links for tutorial walkthroughs:
Or follow the steps below for creating & deploying a simple service and learning some simple Serverless commands.
Create a new service
Create a new service using the Node.js template, specifying a unique name and an optional path for your service.
# Create a new Serverless Service/Project
$ serverless create --template aws-nodejs --path my-service
# Change into the newly created directory
$ cd my-service
Deploy, test and diagnose your service
- Deploy the Service
Use this when you have made changes to your Functions, Events or Resources in serverless.yml or you simply want to deploy all changes within your Service at the same time.
serverless deploy -v
- Deploy the Function
Use this to quickly upload and overwrite your function code, allowing you to develop faster.
serverless deploy function -f hello
- Invoke the Function
Invokes a Function and returns logs.
serverless invoke -f hello -l
- Fetch the Function Logs
Open up a separate tab in your console, set your Provider Credentials and stream all logs for a specific Function using this command.
serverless logs -f hello -t
Cleanup
If at any point, you no longer need your service, you can run the following command to remove the Functions, Events and Resources that were created, and ensure that you don't incur any unexpected charges.
serverless remove