3.1 AWS Compute Services

Key Takeaways

  • Amazon EC2 provides resizable virtual servers (instances) in the cloud with full OS-level control — the core IaaS compute service.
  • AWS Lambda is a serverless compute service that runs code in response to events — you pay only for the compute time consumed.
  • Amazon ECS and Amazon EKS are container orchestration services for Docker and Kubernetes workloads respectively.
  • EC2 instance types are optimized for different use cases: General Purpose (T, M), Compute Optimized (C), Memory Optimized (R, X), Storage Optimized (I, D), and Accelerated Computing (P, G).
  • Auto Scaling automatically adjusts the number of EC2 instances based on demand to maintain performance and minimize cost.
Last updated: March 2026

AWS Compute Services

Quick Answer: AWS compute services range from full virtual servers (EC2) to fully serverless (Lambda). Know when to use each: EC2 for full OS control, Lambda for event-driven code, ECS/EKS for containers, Elastic Beanstalk for managed web apps, and Fargate for serverless containers.

Amazon EC2 (Elastic Compute Cloud)

Amazon EC2 is the foundational compute service that provides resizable virtual servers (called instances) in the cloud. It is the most widely used AWS compute service and the core of the IaaS model.

EC2 Key Features

  • Full control over the operating system (Linux, Windows, macOS)
  • Multiple instance types optimized for different workloads
  • Flexible pricing models (On-Demand, Reserved, Spot, Dedicated)
  • Security Groups for firewall control
  • Elastic IP addresses for static public IPv4 addresses
  • Instance store and EBS volumes for storage

EC2 Instance Families

FamilyOptimized ForExamplesUse Cases
General Purpose (T, M)Balanced compute, memory, networkingt3.micro, m6i.largeWeb servers, code repos, small databases
Compute Optimized (C)High-performance processorsc6i.xlargeBatch processing, gaming servers, HPC
Memory Optimized (R, X)Large in-memory datasetsr6i.large, x2idn.largeIn-memory databases, real-time big data analytics
Storage Optimized (I, D)High sequential read/write to local storagei3.large, d2.xlargeData warehousing, distributed file systems
Accelerated Computing (P, G)Hardware accelerators (GPUs)p4d.24xlarge, g5.xlargeMachine learning training, graphics rendering

On the Exam: You do NOT need to memorize specific instance sizes or prices. Know the instance families and their use cases: T/M = general, C = compute, R/X = memory, I/D = storage, P/G = GPU/accelerated.

EC2 Pricing Models

Pricing ModelDescriptionBest ForSavings vs. On-Demand
On-DemandPay by the second/hour with no commitmentShort-term, unpredictable workloadsBaseline (no savings)
Reserved Instances (RI)1-year or 3-year commitment for significant discountsSteady-state, predictable workloadsUp to 72%
Savings PlansCommitment to consistent compute usage ($/hour)Flexible reserved pricing across instance familiesUp to 72%
Spot InstancesBid on unused EC2 capacity at steep discountsFault-tolerant, flexible workloadsUp to 90%
Dedicated HostsPhysical server dedicated to your useCompliance, licensing requirementsVaries
Dedicated InstancesInstances on hardware dedicated to your accountCompliance requirementsVaries

On the Exam: Key pricing distinctions: On-Demand = no commitment, RI = specific instance commitment, Savings Plans = flexible commitment, Spot = cheapest but can be interrupted, Dedicated = regulatory compliance.

EC2 Auto Scaling

EC2 Auto Scaling automatically adjusts the number of EC2 instances to match demand:

  • Scale out — Add instances when demand increases
  • Scale in — Remove instances when demand decreases
  • Maintains desired count — Automatically replaces unhealthy instances

Scaling policies:

PolicyDescription
Target trackingMaintain a specific metric (e.g., CPU at 50%)
Step scalingScale in steps based on alarm thresholds
Scheduled scalingScale based on predictable patterns (e.g., business hours)
Predictive scalingUses ML to predict demand and scale proactively

AWS Lambda (Serverless Compute)

AWS Lambda is a serverless compute service that runs your code in response to events without provisioning or managing servers.

FeatureDetail
PricingPay per request and compute duration (millisecond billing)
Max runtime15 minutes per invocation
LanguagesPython, Node.js, Java, Go, C#, Ruby, custom runtimes
TriggersAPI Gateway, S3, DynamoDB, SNS, SQS, CloudWatch Events, and more
ScalingAutomatic — scales to thousands of concurrent executions
ManagementZero server management (no OS patching, no capacity planning)

When to use Lambda:

  • Event-driven processing (file upload to S3 triggers processing)
  • API backends (API Gateway + Lambda)
  • Data processing (stream processing from Kinesis)
  • Scheduled tasks (cron-like jobs with EventBridge)
  • Short-duration tasks (under 15 minutes)

Container Services

Amazon ECS (Elastic Container Service)

AWS's proprietary container orchestration service for running Docker containers. Supports both EC2 launch type (you manage the instances) and Fargate launch type (serverless).

Amazon EKS (Elastic Kubernetes Service)

A managed Kubernetes service for running Kubernetes clusters on AWS. Choose EKS if your organization already uses Kubernetes.

AWS Fargate

A serverless compute engine for containers that works with both ECS and EKS. You do not manage servers — just define your containers and Fargate handles the infrastructure.

ServiceDescriptionWhen to Use
ECSAWS-native container orchestrationDocker containers, AWS-ecosystem preference
EKSManaged KubernetesKubernetes-standard, multi-cloud portability
FargateServerless containers (for ECS or EKS)Do not want to manage EC2 instances for containers

Other Compute Services

ServiceDescriptionUse Case
AWS Elastic BeanstalkPaaS — deploy web apps without managing infrastructureDevelopers who want to focus on code, not infrastructure
Amazon LightsailSimple VPS with pre-configured appsSmall blogs, websites, simple applications
AWS BatchRun batch computing jobs at any scaleLarge-scale data processing, scientific computing
AWS App RunnerFully managed service for containerized web appsDeploy containers from source code or image
Amazon WorkSpacesManaged virtual desktop (DaaS)Remote workers needing Windows or Linux desktops
Test Your Knowledge

A company has a workload that runs continuously 24/7 and is expected to run for the next 3 years. Which EC2 pricing model would provide the MOST cost savings?

A
B
C
D
Test Your Knowledge

Which AWS compute service allows you to run code without provisioning or managing servers?

A
B
C
D
Test Your Knowledge

A company wants to run Docker containers but does not want to manage the underlying EC2 instances. Which combination should they use?

A
B
C
D
Test Your Knowledge

Which EC2 instance family should you choose for a workload that requires high-performance GPUs for machine learning training?

A
B
C
D
Test Your Knowledge

What is the maximum execution time for a single AWS Lambda function invocation?

A
B
C
D