Part 1: AWS Serverless Web Application Basic Tutorial

Introduction

AWS Serverless Basic Requirements

AWS Serverless Web Application requires a minimum of three AWS services.

  • S3 – which serves HTML, JavaScript and CSS.
  • Lambda – Serverless compute to fulfil client’s requests.
  • API Gateway – Client uses these API requests to call Lambda functions.

We will also use AWS Simple Email Service in our lambda tutorial to send emails. So lets see what each of those services are:

S3

AWS S3 is an object storage system that stores as much data as you want. It stores in any of the available AWS regions and the data is available from anywhere on the internet. The advantage of using S3 is its reliability, high availability, durability and scalability. There are different types of S3 storage like Standard, Standard Infrequent Access, One Zone Infrequent Access and there is also Glacier archival service. All of these have different benefits and limitations. Check the above link that compares these storage types.

Lambda Function

AWS Lambda functions truly unleash the power of serverless computing. Using this we only pay for the compute time, which means that you are paying it only when someone is using it. Lets say, you have a traditional client-server architecture. When you deploy an application to the server, no matter if someone uses it or not you will be charged. But with Lambda function, you will only pay when someone uses it.

It also has many other advantages like high availability and can scale out to as much computation as you require. And all of this without having to manage the servers. Awesome right. Lambda can be triggered from different AWS services like S3, Kinesis, DynamoDB, CloudWatch and SNS.

At present, lambda supports writing code in five programming languages which are C#, Go, Java, NodeJS and Python. In this article, we are going to use NodeJS.

Simple Email Service (SES)

AWS Simple Email Service is the email service to send e-mail to your clients or yourself. It is a simple, reliable and cost-effective solution for any type of business. There is one catch for it though. You have to request for production access, if you were to send email to non-verified accounts. Otherwise your account will be under AWS SES Sandbox status. Sandbox status means that you can only send emails to verified accounts. In the part 3 tutorial, you will see on how to verify an account.

Follow steps in the link to be eligible to send emails to non-verified e-mail accounts. In this article, we will only send to verified e-mail account.

Note: AWS SES is only available in EU (Ireland), US East (N. Virginia) and US West (Oregon) at the time of writing this article. So in this article, I will use US East as location for SES.

API Gateway

AWS API Gateway is a fully-managed AWS service. Within a few clicks you will be able to create and publish a secure API. This is the service that integrates S3 website with lambda function. Now lets move on to the implementation.

Architecture Diagram

After our tutorial, we will build a serverless web application that has the following architecture.

AWS Serverless Architecture.png
AWS Serverless Web Application Basic Architecture

Step-By-Step

Since our tutorial is a long one, we have divided into 3 steps.

  1. First of all, we will create a static website using AWS S3 bucket.
  2. Next we on noteworthy step. Use Lambda function send an email using AWS Simple Email Service (SES).
  3. Finally, integrate it with static website using API Gateway.

Since you are going to create an AWS Serverless website, you need an AWS account. So create it now using this tutorial.

Next: Create a static website using AWS S3 >

Please follow and like us:
error

2 thoughts on “Part 1: AWS Serverless Web Application Basic Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *