AWS Compute Services Explained: EC2, Lambda, ECS, EKS, and Fargate (CLF-C02)
Compute is where your code actually runs on AWS, and CLF-C02 expects you to identify the right compute service for a described workload without hesitation. This lesson covers the full official scope of Task 3.3: Amazon EC2 and its instance families (general purpose, compute optimized, memory optimized, storage optimized, accelerated computing), the container orchestrators Amazon ECS and Amazon EKS, the serverless options AWS Lambda and AWS Fargate, why auto scaling equals elasticity, and what Elastic Load Balancing actually does. You will learn the matching logic the exam tests: who manages the servers, how long the workload runs, and whether capacity should adjust automatically. You will also learn to recognize Elastic Beanstalk, Lightsail, and AWS Batch on sight. By the end, every trigger phrase in a compute question should map to exactly one service in your head.
On this page9 sections
- How CLF-C02 frames compute: who manages what
- Amazon EC2: virtual servers with full control
- EC2 instance families: match the workload to the type
- Auto scaling: elasticity in action
- Elastic Load Balancing: distributing traffic, not adjusting capacity
- Containers on AWS: Amazon ECS vs Amazon EKS
- Serverless compute: AWS Lambda and AWS Fargate
- Recognition-level compute: Elastic Beanstalk, Lightsail, and AWS Batch
- Choosing the right compute service: decision table and a worked scenario
- Identify the appropriate AWS compute service for a described workload
- Match EC2 instance families to their target workloads using trigger words
- Distinguish Amazon ECS from Amazon EKS and the EC2 launch type from Fargate
- Explain when AWS Lambda fits better than EC2 and when it does not
- State why auto scaling provides elasticity and what a load balancer is for
- Recognize Elastic Beanstalk, Lightsail, and AWS Batch at exam level
How CLF-C02 frames compute: who manages what
Every compute question on CLF-C02 is really asking one thing: given this workload, which service is the best fit? To answer quickly, sort the AWS compute portfolio into a small mental map before memorizing details.
At one end sits Amazon EC2 — virtual servers where you control the operating system and everything above it. At the other end sits AWS Lambda — serverless functions where you upload code and AWS handles every server concern. Between them are the container services: Amazon ECS and Amazon EKS orchestrate containers, and each can run those containers either on EC2 instances you manage or on AWS Fargate, which removes instance management entirely. Around this core sit convenience services — AWS Elastic Beanstalk (upload your code, AWS provisions the infrastructure), Amazon Lightsail (simple, low-cost virtual private servers with bundled pricing), and AWS Batch (runs large numbers of batch computing jobs) — plus two capabilities that make compute production-ready: auto scaling, which adjusts capacity to match demand, and Elastic Load Balancing, which distributes traffic across that capacity.
The single most useful axis is management responsibility. With EC2 you patch the guest OS, size the instance, and pay while it runs. With Lambda and Fargate there are no instances to see, patch, or right-size. When a question emphasizes phrases like "no server management", "focus on code, not infrastructure", or "minimal operational overhead", the answer moves toward the serverless end. When it emphasizes "full control of the operating system" or "custom software on the server", it moves toward EC2. Keep this axis in mind; every section below plugs into it.
Amazon EC2: virtual servers with full control
Amazon Elastic Compute Cloud (Amazon EC2) provides resizable virtual servers — called instances — in the AWS Cloud. You choose an Amazon Machine Image (AMI) that defines the operating system and preinstalled software, pick an instance type that defines the CPU, memory, storage, and network profile, and launch. From that point you have administrative (root) access: you can install anything, tune the OS, and run the instance for as long as you like. That combination — full OS control plus long-running capacity — is EC2's identity on the exam.
Because you control the instance, you also carry more responsibility than with any other compute option. Under the shared responsibility model, you patch the guest operating system, manage the software you install, and decide when to scale. You pay for instances while they run (billing stops when you stop or terminate them), and you can change an instance's type to resize it as needs change. That flexibility makes EC2 the default answer for workloads that do not fit a more managed service: migrated (lift-and-shift) applications, software that needs a specific OS configuration, long-running application servers, and anything requiring specialized licensing or agents installed on the host.
Trigger phrases that point to EC2 include "complete control over the operating system", "choice of instance type", "install custom software on the server", and "long-running application with steady traffic". Conversely, if a question stresses that the team wants to avoid provisioning or managing servers altogether, EC2 is the distractor, not the answer. One boundary note: EC2 instances live inside your network environment (Amazon VPC) and across Availability Zones — the networking and global-infrastructure details belong to other task statements, so here you only need to know that EC2 capacity can be spread across multiple Availability Zones for resilience.
EC2 instance families: match the workload to the type
CLF-C02 does not test specific instance sizes or model numbers. It tests whether you can hear a workload description and name the right family. Learn the matching logic, not a catalog.
| Instance family | Optimized for | Example workloads | Trigger words |
|---|---|---|---|
| General purpose | Balanced CPU, memory, and networking | Web servers, small and midsize application servers, development and test environments | "balanced resources", "general web application", "no special requirements" |
| Compute optimized | High-performance processors; CPU-heavy work | Batch processing, media transcoding, dedicated gaming servers, high performance computing (HPC), scientific modeling | "compute-intensive", "high CPU", "gaming server", "batch processing" |
| Memory optimized | Processing large datasets held in memory | In-memory databases and caches, real-time analytics on big datasets, high-performance relational database servers | "in-memory", "large datasets in RAM", "memory-intensive" |
| Storage optimized | High sequential and random I/O to fast local storage | Data warehousing, distributed file systems, log processing, high-frequency transaction processing | "high IOPS", "local storage throughput", "data warehouse", "distributed file system" |
| Accelerated computing | Hardware accelerators (GPUs and other co-processors) | Machine learning training and inference, graphics rendering, video processing | "GPU", "machine learning training", "graphics-intensive" |
The exam's own examples are compute optimized and storage optimized, so give those two extra attention. The classic trap is confusing memory optimized with storage optimized: memory optimized means the dataset lives in RAM (in-memory database); storage optimized means the workload hammers fast local disks (data warehousing, distributed file systems). Read the question for whether the bottleneck is RAM or disk I/O, and the answer falls out. If no special need is stated at all, general purpose is the safe pick.
Auto scaling: elasticity in action
The exam guide states the skill plainly: recognize that auto scaling provides elasticity. Elasticity means capacity grows when demand grows and shrinks when demand falls — automatically, without a human forecasting or intervening. On AWS, the service that delivers this for virtual servers is Amazon EC2 Auto Scaling.
With EC2 Auto Scaling you define an Auto Scaling group: a collection of EC2 instances with a minimum, maximum, and desired count. Scaling policies watch demand signals such as average CPU utilization and add instances (scale out) when load rises, then remove them (scale in) when load drops. The group also performs health checks and automatically replaces instances that fail, which improves fault tolerance as a side benefit. The business payoff is the pairing the exam loves: performance during peaks, savings during troughs — you stop paying for idle capacity you provisioned "just in case".
One line of wider context: AWS Auto Scaling is an umbrella service that can manage scaling for several resource types beyond EC2 (for example, ECS services and DynamoDB throughput) from a single place — at this level you only need to recognize the name. Serverless options scale differently: Lambda scales automatically per request with no scaling group to configure, which is part of why it counts as serverless.
Trigger phrases that map to auto scaling: "automatically adjust capacity", "handle unpredictable or spiky traffic", "pay only for the capacity you need", "add and remove instances based on demand", and the word "elasticity" itself. If a question asks which AWS Cloud benefit auto scaling demonstrates, the answer is elasticity — not high availability, not agility, even though those sound plausible.
Elastic Load Balancing: distributing traffic, not adjusting capacity
Elastic Load Balancing (ELB) automatically distributes incoming application traffic across multiple targets — such as EC2 instances, containers, or Lambda functions — and can spread those targets across multiple Availability Zones. Its purposes, as the exam frames them: increase availability and fault tolerance by ensuring no single target is overwhelmed and by routing around unhealthy ones, and present a single point of contact (one endpoint) for clients regardless of how many servers sit behind it.
Health checks are central to that story. The load balancer continuously probes its targets and stops sending traffic to any that fail, so users are shielded from individual server failures. Combined with targets in more than one Availability Zone, this is a foundational high-availability pattern at the Cloud Practitioner level.
Know the three types at recognition depth only: the Application Load Balancer (ALB) operates at the application layer (layer 7) and routes HTTP and HTTPS traffic based on request content; the Network Load Balancer (NLB) operates at the transport layer (layer 4) for TCP and UDP traffic at very high performance and low latency; and the Gateway Load Balancer is used to deploy and scale third-party virtual network appliances such as firewalls.
Now the classic pair confusion, which CLF-C02 tests directly: auto scaling adjusts capacity; load balancing distributes traffic. Auto scaling changes how many instances exist; a load balancer decides which existing instance receives each request. A load balancer never launches servers, and an Auto Scaling group never routes requests. In real architectures they work as a pair — the load balancer spreads traffic across whatever instances the Auto Scaling group currently maintains — but on the exam, match "distribute traffic" to ELB and "add or remove capacity" to auto scaling every time.
Containers on AWS: Amazon ECS vs Amazon EKS
A container packages an application with its dependencies into a single portable unit that runs identically on a laptop, a test server, or the cloud. Containers start faster and pack more densely than virtual machines, but once you run many of them you need an orchestrator — software that decides where containers run, restarts failed ones, and scales them. AWS offers two managed orchestrators, and the exam wants you to tell them apart.
Amazon Elastic Container Service (Amazon ECS) is the AWS-native orchestrator. It is fully managed, deeply integrated with AWS services such as Elastic Load Balancing and IAM, and has no separate control-plane software for you to learn or operate. Choose ECS when a question describes a team that wants the simplest way to run containers on AWS and has no requirement for Kubernetes.
Amazon Elastic Kubernetes Service (Amazon EKS) is managed Kubernetes — AWS runs the Kubernetes control plane for you, and your workloads use standard Kubernetes APIs and tooling. Choose EKS when the question mentions Kubernetes by name, an existing investment in Kubernetes tooling, or a desire for portability of the orchestration layer across environments. That is the entire ECS-versus-EKS decision at this level: AWS-native simplicity (ECS) versus the Kubernetes standard (EKS).
Both orchestrators still need somewhere for the containers to execute, and that brings in the launch-type choice. With the EC2 launch type, your containers run on a cluster of EC2 instances that you provision, patch, and scale — more control, more responsibility. With AWS Fargate, AWS runs your containers on serverless compute: there are no instances to manage at all, and you pay for the vCPU and memory your containers request while they run. If the question says "run containers without managing servers or clusters", the answer is Fargate; if it says the team needs control over the underlying container hosts, it is the EC2 launch type. One-line neighbor to recognize: Amazon ECR (Elastic Container Registry) stores container images — it is a registry, not a compute service.
Serverless compute: AWS Lambda and AWS Fargate
Serverless does not mean there are no servers — it means you never see, provision, patch, or scale them. AWS operates the fleet; you bring code or containers. CLF-C02 names two serverless compute options: AWS Lambda and AWS Fargate.
AWS Lambda runs your code as functions in response to events — an object landing in an S3 bucket, an HTTP request through API Gateway, a message on a queue, or a schedule. You upload the function, and Lambda handles everything else: it runs the code only when triggered, scales automatically from zero to thousands of parallel executions, and charges you per request and per unit of compute time consumed. When nothing invokes the function, you pay nothing for compute. The trade-off is that Lambda is built for short-running tasks — a function execution is capped at minutes (15 at most), not hours — so it suits event handlers, file processing, lightweight APIs, and glue logic rather than long-lived processes.
That sets up the exam's favorite comparison, Lambda vs EC2. Choose Lambda when the question describes event-driven, intermittent, or short-duration work and stresses zero server management or pay-per-use billing ("run code only when a file is uploaded", "no infrastructure to manage"). Choose EC2 when the workload runs continuously for long periods, needs a full operating system, custom runtime software on the host, or execution beyond Lambda's short-task model. "A script that runs for a few seconds whenever an image is uploaded" is Lambda; "an application server that must run 24/7 with a customized OS" is EC2.
AWS Fargate is the serverless option for containers: it provides the compute engine underneath Amazon ECS or Amazon EKS so you run containers without managing EC2 instances. Keep the two straight with one rule — Lambda runs functions; Fargate runs containers. If the workload is already packaged as a container, or needs to run longer than a short function allows but the team still wants no servers, Fargate is the answer. Note that Fargate is not an orchestrator itself; it is the serverless place where ECS- or EKS-managed containers execute.
Recognition-level compute: Elastic Beanstalk, Lightsail, and AWS Batch
Three more services appear in compute questions, and one line of recognition each is genuinely all CLF-C02 asks for — but that line has to be exact, because each service is a well-crafted distractor for the others.
AWS Elastic Beanstalk is a platform as a service (PaaS) for deploying web applications: you upload your code, and Elastic Beanstalk automatically handles the provisioning — EC2 instances, capacity, auto scaling, load balancing, and health monitoring — while you retain full visibility into, and control over, the underlying resources it creates. The trigger is a developer who wants to deploy code quickly without configuring infrastructure, using familiar servers underneath. Distinguish it from Lambda: Beanstalk deploys a whole web application onto managed EC2 infrastructure; Lambda runs individual functions with no infrastructure model at all.
Amazon Lightsail offers simple virtual private servers (VPS) with everything bundled — compute, storage, networking, and a predictable low monthly price — plus one-click application blueprints such as WordPress. Its trigger words are "simple", "small project or website", "predictable monthly cost", and "minimal AWS experience". If a question describes a beginner launching a small blog with straightforward pricing, Lightsail beats EC2 even though both are virtual servers.
AWS Batch runs batch computing workloads at any scale: you submit jobs, and Batch plans, schedules, and provisions the right amount of compute to execute hundreds or thousands of them, then releases it. The trigger is "large numbers of batch jobs" — think overnight financial risk calculations or scientific simulations — with no desire to manage job-scheduling infrastructure. Do not confuse the service AWS Batch with the instance family suited to CPU-heavy batch work (compute optimized); a question about picking an EC2 family for batch processing wants compute optimized, while a question about a managed service to schedule and run thousands of jobs wants AWS Batch.
Choosing the right compute service: decision table and a worked scenario
Bring it together with the decision logic you will actually use in the exam room. Read the question for three signals — management appetite (who patches and scales?), duration and trigger (always-on, or event-driven and short?), and packaging (raw code, a container, or a whole application?) — then consult this map.
| Service | When to choose it | Trigger phrases |
|---|---|---|
| Amazon EC2 | Full OS control, custom host software, long-running or migrated workloads | "complete control", "choose the operating system", "lift and shift" |
| AWS Lambda | Event-driven, short-running code with zero server management, pay per use | "runs when triggered", "no servers to manage", "pay only when code runs" |
| AWS Fargate | Run containers without provisioning or managing any instances | "serverless containers", "no cluster of instances to manage" |
| Amazon ECS | Container orchestration the AWS-native way, deep AWS integration | "simplest way to orchestrate containers on AWS" |
| Amazon EKS | Managed Kubernetes; existing Kubernetes skills or portability requirement | "Kubernetes", "standard Kubernetes tooling" |
| AWS Elastic Beanstalk | Deploy a web app fast; AWS provisions and manages the infrastructure | "upload code and let AWS handle deployment" |
| Amazon Lightsail | Simple VPS for small projects at a predictable monthly price | "simple website", "predictable low cost", "easy to start" |
| AWS Batch | Schedule and run large volumes of batch computing jobs | "thousands of batch jobs", "job queues" |
Now a realistic scenario. A media startup runs three workloads. First, whenever a user uploads a video, a short piece of code must generate a thumbnail — event-driven, seconds long, spiky: Lambda. Second, its main API is containerized, and the platform team already operates Kubernetes elsewhere and wants the same tooling without running a control plane — EKS, and because they refuse to manage worker instances, the containers run on Fargate. Third, its public website runs on virtual servers that must handle unpredictable evening traffic spikes: EC2 in an Auto Scaling group (elastic capacity) behind an Application Load Balancer (traffic distribution across Availability Zones). Every choice traces back to the three signals — practice reducing scenarios to those signals and Task 3.3 questions become mechanical.
Tip. CLF-C02 tests this task almost entirely through service-matching scenarios: a one-paragraph workload description asks which compute service fits, and the options typically mix EC2, Lambda, Fargate, and ECS or EKS, so you must key on management responsibility, duration, and packaging. Instance-family items describe a workload characteristic — CPU-heavy batch processing, an in-memory dataset, heavy local disk I/O — and ask you to name the optimized family. Expect at least one item equating auto scaling with the elasticity benefit, and one asking the purpose of a load balancer, often with 'adjusts capacity' planted as the wrong answer. Beanstalk, Lightsail, and Batch appear mainly as distractors or in simple 'which service lets a developer just upload code' recognition items.
- EC2 = virtual servers with full OS control; you patch, size, and scale them, and they suit long-running workloads.
- Instance families by trigger: compute optimized = CPU-heavy (batch, gaming, HPC); memory optimized = in-memory datasets; storage optimized = high local disk I/O (data warehousing); accelerated = GPUs/ML; general purpose = balanced.
- Lambda runs short, event-driven functions with zero server management and pay-per-use billing; choose EC2 instead for long-running or full-control workloads.
- Fargate is serverless compute for containers under ECS or EKS — Lambda runs functions, Fargate runs containers.
- ECS is AWS-native container orchestration; EKS is managed Kubernetes — pick EKS whenever the question says Kubernetes or portability.
- Auto scaling adjusts capacity to demand — that is elasticity; a load balancer distributes traffic across existing targets for availability and fault tolerance.
- ELB types at a glance: ALB = HTTP/HTTPS (layer 7), NLB = TCP/UDP (layer 4), Gateway LB = third-party network appliances.
- One-liners: Elastic Beanstalk = upload code, AWS provisions everything; Lightsail = simple VPS at a fixed monthly price; AWS Batch = managed batch job execution.
Frequently asked questions
What is the difference between AWS Lambda and EC2?
EC2 gives you virtual servers with full operating system control: you choose the instance type, install software, patch the OS, and pay while instances run — ideal for long-running applications and migrated workloads. Lambda is serverless: you upload code that runs only when an event triggers it, AWS manages all servers and scaling automatically, and you pay per request and execution time. Choose Lambda for short, event-driven tasks with no infrastructure management; choose EC2 for continuous workloads, custom OS requirements, or anything that runs longer than Lambda's short-task limits.
What is AWS Fargate used for?
AWS Fargate is a serverless compute engine for containers. It works with Amazon ECS and Amazon EKS, running your containers without requiring you to provision, patch, or scale any EC2 instances. You define the CPU and memory each container needs, and you pay for those resources while the container runs. Use Fargate when a team wants to run containerized applications but does not want to manage a cluster of servers. Remember the exam distinction: Fargate runs containers, while Lambda runs individual functions.
What is the difference between ECS and EKS?
Both are managed container orchestration services on AWS. Amazon ECS is the AWS-native orchestrator — fully managed, tightly integrated with services like Elastic Load Balancing and IAM, and the simplest way to run containers if you have no Kubernetes requirement. Amazon EKS is managed Kubernetes: AWS operates the Kubernetes control plane while you use standard Kubernetes APIs and tooling. Choose EKS when a scenario mentions Kubernetes, existing Kubernetes expertise, or portability of the orchestration layer; choose ECS for AWS-native simplicity. Both can run containers on EC2 instances or on serverless AWS Fargate.
What are the EC2 instance types and when do you use each?
For the CLF-C02 exam you need the five families, not model numbers. General purpose instances balance CPU, memory, and networking for web servers and dev/test. Compute optimized instances serve CPU-intensive work like batch processing, gaming servers, and high performance computing. Memory optimized instances handle large datasets in RAM, such as in-memory databases. Storage optimized instances deliver high I/O to fast local storage for data warehousing and distributed file systems. Accelerated computing instances use GPUs and other hardware accelerators for machine learning and graphics workloads.
How does auto scaling provide elasticity in AWS?
Elasticity means capacity automatically grows and shrinks with demand. Amazon EC2 Auto Scaling delivers it by managing a group of instances with minimum, maximum, and desired counts: when demand rises, scaling policies launch more instances (scale out); when demand falls, they terminate the extras (scale in). This keeps performance steady during peaks while eliminating payment for idle capacity during quiet periods. It also replaces unhealthy instances automatically. On the exam, when a question links automatic capacity adjustment to a cloud benefit, the answer is elasticity.
What does a load balancer do in AWS?
Elastic Load Balancing distributes incoming traffic across multiple targets — EC2 instances, containers, or Lambda functions — and can spread them across multiple Availability Zones. It improves availability and fault tolerance by health-checking targets and routing traffic away from failed ones, and it gives clients a single endpoint no matter how many servers run behind it. AWS offers the Application Load Balancer for HTTP/HTTPS (layer 7), the Network Load Balancer for TCP/UDP (layer 4), and the Gateway Load Balancer for third-party appliances. A load balancer distributes traffic; it never adds or removes capacity — that is auto scaling's job.
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.