Serverless 101

Beginners guide for Serverless computing

Devin Rathnayake
Enlear Academy

--

Hi, In this article, I’m going to cover serverless architecture in terms of AWS services integration. If you are new to serverless, this article is for you. There are more than 200 AWS services available at this moment that can be used to implement the serverless architecture, But here I use some primary services to explain since this is an introductory article for serverless beginners.

Cover Image

Before jumping into AWS services, we need to understand serverless clearly.

What is serverless?

  • Build and run applications without managing servers/infrastructure.

The conventional approach in the cloud is, we have to install OS to servers manually, provision infrastructure based on demand, install security patches, and keep track of security threats. When it comes to serverless, all these managements are done by cloud providers like AWS, Azure, and GCS. Automatic scalability and provisioning do not need to be done manually.

  • Pay as you go

We actually pay for what we consume. This is an immense benefit for the users because they do not need to pay when servers are up on time, but serverless, we only pay for what we use.

What are the primary AWS services that can use in serverless?

  • Lambda
  • API Gateway
  • DynamoDB
  • Cognito
Icons

Lambda

Lambda functions are used to run the business logic of the application. It is a computing service offered by AWS. It provided different run time environments such as .NET, .NET Core, Go, Node Js, etc.

Lambda NodeJS environment

API Gateway

API Gateway is one of the common API services that can use to invoke lambda functions. It provides a fully managed REST API service that is compatible with lambdas.

API Gateway Console

DynamoDB

AWS offers several database services like dynamo DB, relational databases (RDS), aurora, Open search, etc. among them, dynamo DB is the standard option for the serverless application. It is NoSQL, key-value pair low latency database service that can scale well on-demand requirements.

DynamoDB Console

Cognito

Cognito is an identity and access management service. When an application grows, it will have a large number of users and different types of users, etc. in that instance, if users are managing in the same server, we will have scalability problems. Cognito will scale based on the demand of users, and we do not need to worry about managing user authentication and authorization functionality.

Cognito User Pool Console

Let’s see the serverless architecture of a simple Todo application

Todo Serverless architecture. source: https://aws.amazon.com/serverless/

Amplify service is used to integrate with the backend of the application. It will manage calls of the API, caching, and error handling in the client application. As mentioned above, Cognito handles user authentication; unauthorized users cannot access the API.

API Gateway invokes lambda functions based on client requests. Lambda function is created for each CRUD (Create, Read, Update, Delete) operation. Lambdas are associated with dynamo DB and based on invoked lambda, it performs database operations.

Conclusion

Serverless architecture is simple and scalable based on demand. For users, it is cost-effective because we need to pay for what we use. In this article, I tried to explain in the simplest way anyone could understand. There are many AWS services available that you can use to implement/improve the serverless backend. Not only AWS, but you can also use different cloud providers. I wish you the very best for your cloud journey! 😇

--

--

IT undergraduate, IT person. Love to share knowledge with others. Feel free to contact me at anytime.