AWS Serverless Basic Requirements
AWS Serverless Web Application requires a minimum of three AWS services.
- 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:
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.
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.
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.
After our tutorial, we will build a serverless web application that has the following architecture.
Since our tutorial is a long one, we have divided into 3 steps.
- First of all, we will create a static website using AWS S3 bucket.
- Next we on noteworthy step. Use Lambda function send an email using AWS Simple Email Service (SES).
- 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.
He has over 9 years of experience in design, development and implementation of innovative business IT solutions. He is highly skilled in cloud computing, information management and application architecture. In free time, he writes some blogs and strives to learn new technical skills. Check out his recent blogs here.