Getting started with AWS Lambda and API Gateway

G

In this article we will talk about AWS Lambda and API Gateway. To demonstrate how these services work, We will create a Node.js function and execute it using AWS Lambda. Finally we will execute the Lambda from a http rest api using AWS API Gateway.

Serverless

Serverless applications depend on third party services known as BaaS (Backend as a Service). In this case one of the popular service will be AWS Lambda, By using serverless solution such as Lambda we can remove the need of traditional server architecture and execute services as functions hosted on a BaaS system. A serverless architecture can significantly reduce operational cost by running the functions only when we need them.

What are we building ?

We are building an Node.js function which takes a string  as a parameter and replaces emojis in the string wherever applicable and returns it. Don’t worry we are not writing it now, I have taken care of that problem already :). Go ahead and download it from the GitHub repository below. Also lets make sure you have an AWS account before we start.

Cool, now that we have everything, lets get our hands dirty on AWS Console.

Setup AWS Lambda

Below is a video i created to demonstrate how to create a Lambda function with Node.js.

Setup AWS API Gateway

The video below shows how to create a rest api (using AWS API Gateway) to access our lambda function we just created above. The intention is to create a post request which will take text as argument and return the emojified text.

Thats’s it. That was easy right ?

Other Serverless Solutions

Azure Functions
Google Cloud Functions
Firebase Functions (Internally Uses Google Cloud)
Other many interesting solutions can be found in the Awesome Serverless GitHub page.

About the author

Subodh Jena

I'm an open minded liberal type with curiosity as perhaps my main motivator. I love science, art, the natural world and learning from people of diverse backgrounds.

Add comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest updates

Subscribe to Blog