How to create a serverless website with AWS Lambda

Thorn Technologies
Head in the Clouds
Published in
2 min readApr 10, 2018

Learn how to put together a serverless Lambda web app using API Gateway, DynamoDB, and S3

In this tutorial, we’ll show you how to create a serverless stack with AWS Lambda. Check out the thorntech.com blog for even more help with cloud computing, including tips and documentation about SFTP Gateway for AWS, Azure and Google Cloud.

What we mean by “serverless” is that you can set up your app architecture without standing up any EC2 instances. This gives you two benefits:

  1. You don’t have to pay for idle server uptime.
  2. Your app is elastic, meaning it can automatically scale up and down with spiky traffic. So you only pay for what you use.

The sample app in the presentation is a simple voting website. As a user, you pick a presidential candidate on a form. The results are tallied on the bottom.

The app architecture leverages a few AWS managed services. Managed services help you reduce cost and maintenance.

  • API Gateway: This creates a POST endpoint for user votes, and forwards an event to Lambda.
  • Lambda: These are scalable containers for the app. There are two Lambda functions:
    Function 1: Updates the database with a user’s vote
    Function 2: Updates the website with the latest results
  • DynamoDB: The data is stored in a managed NoSQL database.
  • S3: HTML/CSS/JS files are hosted as a website. A JSON file on S3 caches the latest tallies, which reduces the number of calls to DynamoDB.

You can watch the recorded presentation on YouTube.

You can also check out the slide deck here.

Here’s the sample code and the live demo site in action.

This is a good opportunity to get some hands-on experience integrating several AWS services. You don’t need any experience with Node.js or React in order to follow along.

Got any tips for using AWS Lambda? Have any suggestions for future topics? Feel free to add your thoughts to the comments.

Like this post? It likes you too. :)

If you enjoyed this post, please give it some claps so others can discover it more easily!

This article was originally published on ThornTech.com

--

--

Thorn Technologies
Head in the Clouds

Makers of SFTP Gateway. #Cloudcomputing and #mobile experts specializing in #cloud migrations, #bigdata, #enterprise apps, and more.