Getting started with Serverless and AWS

Subscribe to my newsletter and never miss my upcoming articles

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.

- Cloudfare

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

Screenshot (67).png

Screenshot (68).png

Screenshot (69).png

Screenshot (70).png

Screenshot (71).png

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 .

Screenshot (73).png

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.

Screenshot (74).png

Congrats! We've successfully created and deployed our serverless function to AWS. More tutorials on AWS & Serverless coming soon.

ayoosh pandey's photo

Your blog's are amazing sir ! 👍

Neha Singh's photo

Good work. Thanks for sharing!

Silvi Sharma's photo

Informative

Abhijeet Prasad's photo

thank you Silvi! <3