Serverless computing, as an execution model in cloud computing, involves the cloud provider taking care of server management tasks on your behalf. This enables you to concentrate on coding and deploying applications without the need to deal with server setup, configuration and scaling.
Below are several important features of serverless computing:
1. Cost Efficiency: With serverless computing, you are only charged for the resources your code utilizes during its execution. This eliminates the necessity of provisioning and paying for idle servers, resulting in significant cost savings.
2. Scalability: Serverless applications have the ability to automatically scale up or down in response to demand. This ensures that your application can seamlessly handle sudden increases in traffic without requiring any manual intervention.
3. Abstraction: Serverless computing abstracts the underlying server infrastructure, freeing you from concerns about the operating system, patching, or security updates. This allows you to focus solely on developing and deploying your code without worrying about the underlying infrastructure.
What Is AWS Lambda
AWS Lambda is a service provided by Amazon Web Services (AWS) that offers serverless computing capabilities. With this service, you can execute code without the need to provision or manage any servers.
AWS Lambda Programming Model
The interface between your code and the AWS Lambda service is defined by the AWS Lambda programming model. It provides a framework for organizing and interacting with your code to ensure smooth execution within the Lambda environment.
It can be divided into three basics part
1. Triggers: Triggers in AWS Lambda serve as the catalyst for executing your Lambda function by responding to events or mechanisms. They play a crucial role in connecting external events with your code.
Example:
2. Handler Function: The Lambda handler function in AWS Lambda serves as the starting point for your code. It is the specific code segment that is executed when an event triggers your Lambda function.
Example:
3. Code: In the realm of AWS Lambda, the code pertains to a collection of instructions composed in a programming language that is supported, and it defines the functionality of your Lambda function. This code is executed within a serverless environment that is overseen by AWS Lambda once it receives a trigger event.
When To Avoid Using AWS Lambda
1. Long running task
2. State Management
3. Extreme real-time responses
4. Complex computing
5. Complex orchestration