AWS Cloud Practitioner ← Back to blog

AWS CCP Study Guide: Compute Services

24 April 2026 · Matt

EC2, Lambda, ECS, Fargate, Elastic Beanstalk, and Lightsail — what each does and when to use it.

EC2 — Elastic Compute Cloud

Virtual machines in the cloud. You choose the instance type (CPU, RAM, network), the AMI (operating system image), and you're responsible for patching and management. Key concepts:

  • Instance types: General purpose (t3, m6), compute optimised (c6), memory optimised (r6), storage optimised (i3).
  • Pricing models: On-Demand (pay per second), Reserved (1–3 year commitment, up to 72% discount), Spot (spare capacity, up to 90% discount but can be interrupted), Dedicated Host (physical server, licensing compliance).
  • Auto Scaling: Automatically adds or removes EC2 instances based on demand. Pairs with an Application Load Balancer to distribute traffic.
  • AMI: Amazon Machine Image — the snapshot of an instance (OS + software) used to launch new instances.
  • User Data: Bootstrap script that runs once when an instance first starts. Used to install software or run configuration commands.
  • Instance metadata: Available at http://169.254.169.254/latest/meta-data/ from within the instance — exposes instance ID, IAM role credentials, region, etc.
# EC2 use case decision guide
if fully_managed and stateless and < 15min:
    → Lambda
elif containers and no OS management:
    → ECS on Fargate
elif need OS control or long-running process:
    → EC2
elif simple app with no infra knowledge:
    → Elastic Beanstalk or Lightsail
Exam tip: "Lift and shift" migrations = EC2. "Least operational overhead" = Lambda or Fargate. "Lowest cost for steady-state workload" = Reserved Instances.

Lambda — Serverless Functions

Run code without managing servers. You upload a function, define a trigger, and Lambda scales automatically to zero when idle. Pay only for actual execution time.

  • Triggers: API Gateway, S3 events, DynamoDB Streams, CloudWatch Events, SNS, SQS, EventBridge.
  • Limits: 15-minute max execution, 10 GB memory, 512 MB–10 GB ephemeral /tmp storage, 1,000 concurrent executions (default, soft limit).
  • Pricing: First 1M invocations free/month, then $0.20/million. Plus $0.0000166667 per GB-second.
  • Cold starts: First invocation after idle takes longer (JVM/container init). Use Provisioned Concurrency to pre-warm for latency-sensitive APIs.
  • Layers: Package shared dependencies (libraries, runtimes) as reusable layers attached to multiple functions.

ECS & Fargate — Container Compute

ECS (Elastic Container Service) orchestrates Docker containers. You can run tasks on EC2 instances you manage, or on Fargate — AWS-managed infrastructure where you never touch a server.

  • ECS on EC2: more control, lower cost at scale, you manage the cluster and patching.
  • ECS on Fargate: fully managed, per-vCPU/GB-hour billing, no cluster maintenance. This portfolio uses Fargate.
  • EKS (Elastic Kubernetes Service): managed Kubernetes. More complex than ECS, useful if you already use Kubernetes tooling.
  • Task Definition: Blueprint for your container — image, CPU/memory, env vars, IAM role, port mappings.
  • Service: Keeps N copies of a task running, integrates with ALB for load balancing and health checks.

Elastic Beanstalk

PaaS — upload your application code and Beanstalk provisions EC2, load balancers, and Auto Scaling for you. You retain SSH access and configuration control but AWS handles capacity provisioning. Supports Java, .NET, PHP, Python, Ruby, Go, Docker.

Exam tip: Beanstalk = "I want AWS to manage my infrastructure but keep control." Lightsail = "Simple VPS with predictable billing." The distinction matters for the exam.

Lightsail

Simplified VPS for small projects. Fixed monthly pricing ($3.50–$160/month), pre-configured stacks (WordPress, LAMP, Node, Django). Lacks advanced networking, Auto Scaling, and tight integration with other AWS services. Good for simple websites and prototypes, not production microservices.