Serverless On AWS

Introduction 

 
In simple terms, 'serverless' is when you do not need to worry about servers or say operations. In serverless, the operational burden is taken away from you so you can focus more on development.
 
In AWS, Serverless means when you pick up services that are AWS Managed - that is availability, scalability, elasticity, etc are all taken care of by AWS.
 
Some serverless AWS services include:
 
AWS Lambda
 
Lets you run code on AWS. Supported languages are - Python, JAVA, NodeJs, .NET, Ruby, Go . Lambda eliminates the need for a physical server or an EC2 instance, need for a web server, size and scaling of server to serve traffic etc. All you need to do is write your code and you are good to go. You only pay for the minutes your code consumes.
 
API Gateway
 
APIs are very crucial and important for any application. An API gateway lets you create APIs in a serverless way. You can create REST, WebSocket, and Private APIs. The API Gateway connects very well with AWS Services, other HTTP endpoints. API creation and management is very easy with it.
 
DynamoDB
 
DynamoDB is an AWS provided NoSQL database. It works on Key-Value pairs and is a great serverless replacement of any other key-value database. You need to create a DynamoDB table, Indexes (partition and sort keys) and you are good to store data.
 
S3
 
S3 is an object store on AWS. You can store N number of files on S3 and it scales automatically. You can store files like images,documents - text, HTML , pdf , word etc, configuration files.
 
Amazon Aurora
 
Aurora is a serverless relational database offering from AWS. It currently supports - MySQL and Postgres. Aurora can scale automatically at peak times. The relational database model remains the same with aurora so there is no difference in the way we use traditional databases and aurora in our application. It is cost-efficient, durable, reliable, and highly available.
 
Fargate
 
Fargate is a serverless microservice offering that works with ECS and EKS. With Fargate, you need to define your containers and the host management is taken care of by AWS. Fargate makes container operations simple. If you wish to offload host operations, Fargate is the option but if you wish to have some management ECS on EC2 is better.
 
SNS
 
SNS is the notification service from AWS which works on the Publisher-Subscriber model. This service can be leveraged in applications to send a notification.
 
SES
 
SES is the email service from AWS. You can generate an SMTP endpoint with SES and configure the SMTP credentials in application to send out business emails, confirmation emails, no-reply emails, etc.
 
SQS
 
SQS is the Queue service from AWS. You can use it to have a buffer between two components, to maintain the sending and receiving pace, and many more. I already have a dedicated article on SQS, if you want to learn more about it, click here.
 
Step Functions
 
Step functions are workflow orchestrator. It can be used to induce a workflow in your application. For eg, You can have stages for placing an order via step functions.
and many more services.
 
Let's discuss a sample in serverless architecture:
 
Check-In System
 
This is one of the serverless architectures we have.

To describe this:
  • Users will provide check-in information via API created in the API gateway.
  • API gateway Passes the Information to Lambda. Lambda contains the business logic (Code)
  • Lambda fetches the employee information from Aurora for validation
  • Lambda Stores the check-in information, like date and time in DynamoDB
  • Post this Lambda passes a message to SNS topic which sends notification for check in to related subscribers.
  • Cloudwatch stores the logs for the code execution in lambda
Similarly, we can have N number of serverless architecture based on the requirements. In gist, serverless on AWS saves a lot of operational effort and lets us focus on business logic. The pay-as-you-go model of AWS helps it go serverless even more.


Similar Articles