If you're new to the world of cloud computing, you may have heard the term "serverless" and assumed that it means no servers are involved. After all, if something is "serverless," how can it involve servers? However, this is a common misconception, and the truth is that "serverless" doesn't mean "no server" at all. In this blog, we'll explore what "serverless" really means and how it works in practice.
What is Serverless Computing?
Serverless is a cloud computing model where the cloud provider manages the infrastructure and automatically allocates resources as needed. While the term "serverless" can be a bit misleading, it doesn't mean that there are no servers involved. Rather, it means that the developer doesn't have to worry about managing or provisioning the servers themselves. The cloud provider takes care of that, and the developer can focus on writing and deploying code. In a serverless architecture, the developer writes functions that are triggered by specific events, and the cloud provider runs those functions on its own servers, automatically scaling up or down as needed. So, while there are still servers involved, the developer doesn't have to manage them directly.
There are several examples of serverless computing services, including:
AWS Lambda: This is a popular serverless computing service provided by Amazon Web Services (AWS). Developers can write code in various programming languages such as Python, Node.js, and Java, and deploy them as functions that are triggered by specific events, such as a new file being uploaded to an S3 bucket.
Google Cloud Functions: This is another serverless computing service provided by Google Cloud Platform. Developers can write code in various programming languages, such as Node.js and Python, and deploy them as functions that are triggered by specific events, such as a new message being published to a Pub/Sub topic.
All of these services allow developers to write code without worrying about the underlying infrastructure, and they automatically scale up or down as needed, making them ideal for building highly scalable and cost-effective applications.
Serverless functions Use Case:-
Let's say you are building an e-commerce website that sells products to customers. When a customer places an order, you need to send a confirmation email to the customer and update your inventory system.
In a traditional server-based architecture, you would need to set up and manage a server to handle these tasks. However, with a serverless architecture, you can use AWS Lambda or a similar service to handle these tasks without worrying about server management.
Here's how it could work:
When a customer places an order on your website, the order information is sent to an AWS Simple Notification Service (SNS) topic.
An AWS Lambda function is triggered by the SNS topic and sends a confirmation email to the customer using Amazon Simple Email Service (SES).
The same Lambda function also updates the inventory system by making a call to an API.
The Lambda function completes its tasks and shuts down, without the need for any ongoing server management.
This serverless architecture allows you to handle these tasks without worrying about server management, and it scales automatically to handle any number of orders. Additionally, you only pay for the compute time used by the Lambda function, making it a cost-effective solution.
Did you find this article valuable?
Support shamnad sherief by becoming a sponsor. Any amount is appreciated!