EC2 gives you full control over the OS. Choose instance families by workload: T (burstable, general-purpose, cheap), M (balanced), C (compute-optimised, high CPU), R (memory-optimised), I/D (storage-optimised). Purchasing options matter for cost questions: On-Demand for unpredictable short-term work, Reserved/Savings Plans (1 or 3 year, up to ~72% off) for steady-state predictable workloads, Spot Instances (up to 90% off) for fault-tolerant flexible workloads that can handle interruption with a 2-minute warning, and Dedicated Hosts for licensing/compliance needs where you must control the physical server.
Auto Scaling Groups (ASGs) keep the right number of EC2 instances running using a launch template, min/max/desired capacity, and scaling policies (target tracking is the recommended default, e.g. keep average CPU at 50%). ASGs work across multiple Availability Zones for resilience. Elastic Load Balancers spread traffic: Application Load Balancer (ALB) works at Layer 7 for HTTP/HTTPS and supports path/host-based routing, Network Load Balancer (NLB) works at Layer 4 for extreme performance and static IPs, Gateway Load Balancer is for third-party virtual appliances.
Lambda is serverless compute, billed per millisecond of execution and memory used, with no servers to patch. Key numbers to memorise: default timeout is 3 seconds, maximum timeout is 15 minutes, memory is configurable from 128 MB to 10,240 MB, and CPU scales automatically with memory. Deployment package size limits: 50 MB zipped direct upload, 250 MB unzipped including layers, or up to 10 GB using container images. Concurrency: default account concurrent execution limit is 1,000 (soft limit, raisable), and Provisioned Concurrency removes cold starts for latency-sensitive apps. Lambda is ideal for short, event-driven, stateless tasks triggered by S3, API Gateway, DynamoDB Streams, EventBridge, or SQS.
ECS (Elastic Container Service) runs Docker containers using Task Definitions (the blueprint: image, CPU, memory, ports) and Services (which keep a desired number of tasks running, often behind an ALB). Two launch types: EC2 launch type means you manage the underlying EC2 instances yourself (more control, more admin); Fargate is serverless — AWS manages the infrastructure, you just define CPU/memory per task. EKS is AWS's managed Kubernetes alternative for teams already standardised on Kubernetes tooling.