Getting started with Serverless and AWS
Challenge: To install and deploy a Serverless service to AWS.
Pre-requisites: NodeJs, NPM, AWS Account, VS Code.
Difficulty Level: Medium
We'll be covering five major steps to achieve our goal.
0. Introduction.
What is Serverless
Serverless computing is a method of providing backend services on an as-used basis. A serverless provider allows users to write and deploy code without the hassle of worrying about the underlying infrastructure.
1. Setup AWS.
You need an AWS Account to deploy your Serverless Service.
After you've signed up for AWS, let's move to create a new IAM user.
1. Dashboard > IAM > Add User 2. Create User
2. Setup Serverless.
To get started with Serverless, we need to install Serverless on our machines.
1. Install Serverless
npm -g i serverless
2. Configure serverless
serverless config credentials --provider was --key <YOUR ACCESS KEY> --secret <YOUR SECRET ACCESS KEY>
3. Initialize a Serverless Project.
1. Setup Serverless Project
serverless create --template aws-nodejs --path sl-project
Note: You can set whatever name you want to your project, I've chosen sl-project
2. Configure Project
cd sl-project && code .
4. Deploy to AWS.
To deploy our serverless service to AWS, run the following command.
sls deploy
Note: sls
is short for serverless
To check your deployment, head to your Dashboard > Lambda and you'll see your service deployed there.
Congrats! We've successfully created and deployed our serverless function to AWS. More tutorials on AWS & Serverless coming soon.
Comments (6)