top of page

AWS Lambda: The Ultimate Guide for Beginners 1/2

Everything About AWS Lambda: The Ultimate Guide for Beginners 1/2

AWS Lambda: The Ultimate Guide for Beginners 1/2

Written by Hyojung Yoon

Today, we will learn about AWS Lambda, a key player in various IT environments. AWS Lambda enables the provision of services with high availability and scalability, thus enhancing performance and stability in cloud environments like AWS.

In this blog, we'll delve into AWS Lambda, covering its basic concepts, advantages and disadvantages, and real-life use cases. Additionally, we'll compare AWS Lambda with EC2 to understand when to use each service.

Let's get started!


What is AWS Lambda?

1. What is Serverless¹ Computing?

What is Serverless Computing?

AWS Lambda is a serverless computing service. Serverless computing is a cloud computing execution model that allows the operation of backend services without managing servers. Here, you can focus solely on writing code, while AWS manages the infrastructure. This model enables developers to develop and deploy applications more quickly and efficiently.

¹Serverless? A cloud-native development model where developers don't need to provision servers or manage application scaling. Essentially, cloud providers manage server infrastructure, freeing developers to focus more on the actual functionalities they need to implement.

2. AWS Lambda

What is AWS Lambda?

AWS Lambda is an event-driven serverless computing service that enables code execution for a variety of applications and backend services without the need to provision or manage servers.

Users simply provide code in a supported language runtimes (Lambda supports Python, C#, Node.js, Ruby, Java, PowerShell, Go). The code is structured as Lambda functions, which users can write and use as needed.

AWS Lambda offers an automatically triggered code execution environment, ideal for an event-based architecture and powerful backend solutions. For example, code is executed when a file is uploaded to an S3 bucket or when a new record is added to DynamoDB.

3. How AWS Lambda Works

How AWS Lambda Works

Lambda Functions

  • These are resources in Lambda that execute code in response to events or triggers from other AWS services.

  • Functions include code to process events or other AWS service events that are passed to them.

Event Triggers (Event Sources)

  • AWS Lambda runs function instances to process events. These can be directly called using the Lambda API or triggered by various AWS sercies and resources.

  • AWS Lambda functions are triggered by various events, like HTTP requests, data state transitions, file uploads, etc.

How Lambda Works

  • You create a function, add basic information, write code in the Lambda editor or upload it, and AWS handles scaling, patching, and infrastructure management.

Pros and Cons of AWS Lambda

Using AWS Lambda allows developers to focus on development without the burden of server management, similar to renting a car where you only drive, and maintenance is handled by the rental company. However, Lambda functions are stateless, so additional configurations are necessary for state management. Also, the 'cold start' phenomenon can slow initial response times, like a computer waking from sleep.

1. Advantages

1) Serverless Architecture

Developers can focus on development without worrying about server management, akin to renting and driving a car while maintenance is handled by the rental company.

2) Cost-Effective

Pay only for the computing resources actually used. Functions are called and processed only when needed, so you don't need to keep servers running all the time, making it cost-effective. Lambda charges based on the number of requests and the execution time of the Lambda code, so no charges apply when code is not running.

3) Integration with AWS Services

Allows seamless integration and programmatic interactions with other AWS services. Lambda functions also allow programmatic interactions with other AWS services using one of the AWS software development kits (SDKs).

2. Disadvantages

1)Execution Time Limit

Lambda has a maximum execution time of 15 minutes (900 seconds) and a maximum memory limit of 10GB (10240MB). Thus, it is not suitable for long-running processes that exceed 15 minutes.

2) Stateless³

Not suitable for maintaining states or DB connections.


³Stateless? Means that data is not stored between interactions, allowing for multiple tasks to be performed at once or rapidly scaled without waiting for a task to complete.

3) ColdStart

As a serverless service for efficient resource use, Lambda turns off computing power if not used for a long time. When a function is first called, additional setup is needed to run the Lambda function, leading to a delay known as a Cold Start. The cold start phenomenon varies depending on the language used and memory settings.

 The cold start phenomenon varies depending on the language used and memory settings

This initial delay can affect performance by delaying responses.

※ Solutions for Cold Start

1. Use Lambda SnapStart

  • With SnapStart, Lambda initializes the function when you publish a function version. Lambda creates a snapshot of the initialized execution environment's memory and disk state in a Firecracker microVM, encrypts it, and caches the snapshot for quick access with minimal delay.

  • For more details, refer to AWS documentation. AWS 문서

2. Increase the Allocated Memory to Improve Specs

  • The range of cold start delay varies with the function size, allocated memory, and code complexity. Adding memory proportionally increases CPU capacity, enhancing overall computing performance.

3. Activate Provisioned Concurrency

  • An option to have execution environments ready in advance for immediate response to function calls. Activating this reduces delay, but incurs additional costs.

4) Concurrency Limit

By default, Lambda limits the number of Lambda functions that can be executed simultaneously to 1000 per region. Exceeding this number of requests can prevent Lambda from performing.


⁴Concurrency? The number of requests a Lambda function is processing at the same time. As concurrency increases, Lambda provisions more execution environment instances to meet the demand.

Use Cases of AWS Lambda

Lambda is ideal for applications that need to rapidly scale up and scale down to zero when there's no demand. For example, Lambda can be used for purposes like:

1. Automation of System Operations 🎬

Use Cases of AWS Lambda - Automation of System Operations
  • Set up CloudWatch Alarms for all resources.

  • When resources are in poor condition, such as Memory Full or a sudden CPU spike, CloudWatch Alarms trigger a Lambda Function.

  • The Lambda Function notifies the team or relevant parties via Email or Slack Notification.

  • Combine Lambda Function with Ansible for automated recovery in case of failure, such as resetting memory on a local instance or replacing resources when Memory Full occurs.

2. Web Applications 🎬

Web Applications - Automation of System Operations
  • Store Static Contents (like images) in S3 when clients connect.

  • Use CloudFront in front of S3 for fast serving globally.

  • Separately use Cognito for authentication.

  • For Dynamic Contents and programmatic tasks, use Lambda and API Gateway to provide services, with DynamoDB as the backend database.

3. Serverless Batch Processing 🎬

Use Cases of AWS Lambda - Serverless Batch Processing
  • When an object enters S3, a Lambda Splitter distributes tasks to Mappers, and the Mappers save the completed tasks in DynamoDB.

  • Lambda Reducer outputs back to S3.

4. Other Cases

1) Real-Time Lambda Data Processing

Triggered by Amazon S3 Uploads.

[Example] Thumbnail creation for S3 source images.

Use Cases of AWS Lambda - Real-Time Lambda Data Processing

2) Stream Processing

Use Lambda and Amazon Kinesis for real-time streaming data processing for application activity tracking, transaction order processing, clickstream analysis, data cleansing, log filtering, indexing, social media analysis, IoT device data telemetry, etc.

3) IoT Backend

Build a serverless backend using Lambda to handle web, mobile, IoT, and third-party API requests.

4) Mobile Backend

Build a backend using Lambda and Amazon API Gateway to authenticate and process API requests. Integrate easily with iOS, Android, web, and React Native frontends using AWS Amplify.

Differences Between AWS Lambda & EC2

AWS Lambda is serverless and event-driven, suitable for low-complexity, fast execution tasks, and infrequent traffic. EC2, on the other hand, is ideal for high-performance computing, disaster recovery, DevOps, development, and testing, and offers a secure environment.

AWS Lambda


Uses the serverless model, eliminating the need to manage servers.

User management of OS, application updates, security, and network configurations is necessary.

In the serverless environment, it automatically manages computing resources depending on the amount of traffic, and which can be very cost-effective.

In contrast to serverless, it requires the user to manage various aspects such as OS, application updates, security, and network configurations. However, it offers the flexibility to optimize resources.

Focuses on code execution and is highly compatible with AWS Lambda's serverless model.

Users must select an operating system, configure server properties, and then deploy EC2 instances.

It supports a variety of use cases, tailored to different operational scenarios.

It provides a high level of user control.

1. When Should I Use AWS Lambda?

  1. Low-Complexity Code: Lambda is the perfect choice for running code with minimal variables and third-party dependencies. It simplifies the handling of easy tasks with low-complexity code.

  2. Fast Execution Time: Lambda is ideal for tasks that occur infrequently and need to be executed within minutes.

  3. Infrequent Traffic: Businesses dislike having idle servers while still paying for them. A pay-per-use model can significantly reduce computing costs.

  4. Real-Time Processing: Lambda, when used with AWS Kinesis, is best suited for real-time batch processing.

  5. Scheduled CRON Jobs: AWS Lambda functions are well-suited for ensuring scheduled events are triggered at their set times.

2. When Should I Use AWS EC2?

  1. High-Performance Computing: Using multiple EC2 instances, businesses can create virtual servers tailored to their needs, making EC2 perfect for handling complex tasks.

  2. Disaster Recovery: EC2 is used as a medium for disaster recovery in both active and passive environments. It can be quickly activated in emergencies, minimizing downtime.

  3. DevOps: DevOps processes have been comprehensively developed around EC2

  4. Development and Testing: EC2 provides on-demand computing resources, enabling companies to deploy large-scale testing environments without upfront hardware investments.

  5. Secure Environment: EC2 is renowned for its excellent security.


This guide provided an in-depth understanding of AWS Lambda, which plays a significant role in traffic management and server load balancing in the AWS environment. In the next session, we will explore accessing the console, creating and executing Lambda functions, and understanding fee calculations.

We hope this guide helps you in starting and utilizing AWS Lambda, as you embark on your journey into the expansive serverless world with AWS Lambda!


조회수 68회댓글 0개


bottom of page