AWS Lambda - Architecture & Components
Zubair Aslam
| Innovative Leadership | Technology Strategy | Digital Transformation | | Operational Excellence | SAP S/4HANA | AWS | Azure | BPR | RPA | Datalakehouse | AI ML |
AWS Lambda is a server-less computing service provided by Amazon Web Services (AWS). It allows developers to run their code without provisioning or managing servers.
With Lambda, user can execute code in response to various events, such as changes to data in an Amazon S3 bucket, updates to a DynamoDB table, HTTP requests through Amazon API Gateway, or even custom events generated by your applications.
?1. Lambda key features & concepts:
1. Server-less Architecture: Lambda follows a server-less model, meaning user don't need to worry about server provisioning, scaling, patching, or maintenance. AWS automatically handles the underlying infrastructure.
2. Event-Driven Execution: Lambda functions are triggered by events. An event can be anything from an HTTP request, changes in a database, file uploads, to custom events user defines. When an event occurs, AWS Lambda automatically invokes the corresponding Lambda function.
3. Supported Languages: Lambda supports multiple programming languages, including Node.js, Python, Java, Ruby, C#, Go, and more. This allows user to write required functions in the language of his choice.
4. Granular Billing: AWS Lambda bills, based on the number of requests and the execution time of the code. Users are charged for the actual compute resources used during the execution of the code.
5. Triggers and Event Sources: Lambda can be triggered by various AWS services, such as S3, DynamoDB, SNS (Simple Notification Service), CloudWatch Events, and more. These triggers enable the Lambda functions to respond to changes or events in other AWS services.
6. Concurrency and Scaling: Lambda functions can scale automatically to handle varying workloads. AWS manages the scaling of the functions by creating multiple instances of that function as needed.
7. Stateless Execution: Lambda functions are designed to be stateless. Any state information that is needed, must be managed externally, such as in a database or storage service.
8. Cold Starts: When a Lambda function is invoked for the first time or after a period of inactivity, it might experience a "cold start," which is a slight delay due to initializing the runtime environment. Subsequent invocations typically benefit from "warm starts," which are faster.
9. Environment Variables: User can define environment variables for the Lambda functions, which can be used to store configuration values or sensitive information.
10. Integration with Other AWS Service: Lambda is often used in conjunction with other AWS services to build server-less applications. For example, Lambda functions can be connected to API Gateway to create APIs, to Step Functions for orchestrating complex workflows, or to S3 for processing uploaded files.
领英推荐
2. Lambda Architecture:
The architecture of AWS Lambda revolves around event-driven, server-less execution of code. It enables developers to build flexible and scalable applications without the overhead of managing infrastructure, making it an integral part of modern cloud computing architectures.
1. Lambda Functions: These are the individual units of code that developer writes and upload to AWS Lambda. Each function performs a specific task or responds to specific events.
2. Event Sources: These are services or triggers that invoke the Lambda functions. These include services like Amazon S3, Amazon DynamoDB, Amazon SNS, Amazon API Gateway, Cloud-Watch Events, and more. Events from these sources trigger the execution of the Lambda functions.
3. Invocation: When an event occurs in one of the event sources, AWS Lambda automatically invokes the corresponding Lambda function. The event data is passed to the function as input.
4. Runtime Environment: AWS Lambda provides a runtime environment for your functions based on the programming language of choice. It manages the execution of your code, including initialization, execution, and cleanup.
5. Scaling: AWS Lambda automatically scales the functions in response to the incoming workload. If there are many events which are coming in, AWS Lambda will create additional instances of your function to handle the load.
6. Concurrency: Concurrency refers to the number of function instances running at the same time. AWS Lambda can manage concurrency by dynamically adjusting the number of instances based on the number of incoming events.
7. Execution and Invocation Policies: You can configure execution policies to control which AWS resources your Lambda function can access. Invocation policies determine who can trigger your function.
8. Logs and Monitoring: AWS Lambda integrates with Amazon CloudWatch for logging and monitoring. User can view logs to diagnose issues and set up alarms to be notified of specific events or conditions.
9. Environment Variables: Developer can define environment variables for the Lambda functions, allowing developer to pass configuration settings or sensitive information to your code.
10. Integration with Other AWS Services: AWS Lambda can be integrated with other AWS services to build complete server-less applications. For example, user can use AWS Step Functions to create workflows, Amazon API Gateway to create APIs, and Amazon S3 for storage.
11. Networking and VPC Integration: Lambda functions can be configured to access resources within a Virtual Private Cloud (VPC). This allows user to securely connect the functions to private resources like databases.