Compute Services (EC2, Lambda, Containers)
Difficulty: medium
Overview
AWS offers a range of compute services from virtual machines to serverless functions and containers.
Amazon EC2 (Elastic Compute Cloud):
- Virtual servers in the cloud. Full control over OS, networking, storage.
- Instance Families: General Purpose (M/T), Compute Optimized (C), Memory Optimized (R/X), Storage Optimized (I/D), Accelerated Computing (P/G).
EC2 Purchasing Options:
| Option | Use Case | Discount |
|---|---|---|
| On-Demand | Unpredictable workloads; no commitment | Baseline (full price) |
| Reserved (1 or 3 yr) | Steady-state, predictable workloads | Up to 72% vs On-Demand |
| Savings Plans | Flexible commitment ($/hr for 1-3 yrs) | Up to 66% (Compute) |
| Spot Instances | Fault-tolerant, interruptible workloads | Up to 90% vs On-Demand |
| Dedicated Hosts | Bring your own server-bound licenses; compliance | Highest cost |
| Dedicated Instances | Physical isolation at hardware level | Higher than On-Demand |
Serverless Compute:
- AWS Lambda — Run code without servers. Triggered by events. Max execution: 15 minutes. Pay per request and compute time.
- AWS Fargate — Serverless containers. Run ECS or EKS without managing EC2 nodes.
Container Services:
- Amazon ECS — AWS-managed Docker container orchestration.
- Amazon EKS — AWS-managed Kubernetes.
- Amazon ECR — Private container image registry.
Other Compute:
- AWS Elastic Beanstalk — Deploy web apps without managing infrastructure; handles provisioning, load balancing, scaling, and monitoring.
- AWS Lightsail — Simple, predictable-pricing virtual servers for small workloads.
- AWS Batch — Fully managed batch processing at any scale.
Scaling & Load Balancing:
- Amazon EC2 Auto Scaling — Automatically adjusts instance count based on CloudWatch metrics.
- Elastic Load Balancing (ELB) — Distributes traffic across instances/AZs. Types: ALB (HTTP/HTTPS), NLB (TCP/UDP), GLB.
Practice Linked Questions
Q1. Which EC2 purchasing option provides the highest discount (up to 90%) but can be interrupted by AWS with a 2-minute notification when capacity is needed?
Select one answer before revealing.
Q2. A company runs a production database that must be online 24/7 for the next 3 years. Which EC2 purchasing option provides the MOST cost savings?
Select one answer before revealing.
Q3. Which AWS service lets you run code in response to events without provisioning or managing any servers, charging only for the compute time consumed?
Select one answer before revealing.
Q4. What is the maximum execution duration for a single AWS Lambda function invocation?
Select one answer before revealing.
Q5. A company wants to run Docker containers on AWS without managing or provisioning any EC2 instances. Which TWO services allow running containers where AWS fully manages the underlying infrastructure? (Select TWO — more than one answer may be correct)
Select one answer before revealing.
Q6. Which AWS service automatically increases and decreases the number of EC2 instances in response to changing demand metrics like CPU utilization?
Select one answer before revealing.
Q7. Which EC2 purchasing option gives you a physical server dedicated exclusively to your use, which is required to use your existing per-socket or per-core server software licenses?
Select one answer before revealing.
Q8. A developer wants to deploy a web application to AWS quickly without worrying about infrastructure. They want AWS to handle capacity provisioning, load balancing, auto-scaling, and monitoring. Which service is best suited?
Select one answer before revealing.
Q9. A company has a workload with a steady baseline but unpredictable spikes. They want to minimize costs while ensuring spikes are handled. Which combination BEST meets this need?
Select one answer before revealing.
Q10. Which EC2 pricing model offers savings of up to 66% compared to On-Demand and provides flexibility to change instance family, size, OS, and Region during the commitment period?
Select one answer before revealing.