Memory hook: Choose who manages the server, then choose how the capacity is paid for.
Must remember
- EC2 provides virtual machines and OS-level control. General-purpose, compute-optimised, memory-optimised, storage-optimised and accelerated families fit different bottlenecks. More CPU cannot repair a storage bottleneck automatically.
- An AMI is a launch image; user data bootstraps an instance. Auto Scaling adjusts or maintains fleet capacity, while Elastic Load Balancing sends traffic to healthy targets. Multi-AZ capacity and externalised session data help make instances replaceable.
- ECS is AWS container orchestration; EKS provides managed Kubernetes. Fargate supplies serverless compute for supported container tasks/pods. A container image is packaged application content, not an orchestration service.
- Lambda runs functions on events with managed infrastructure and execution limits. It suits bounded processing; persistent state belongs in an appropriate external service. Elastic Beanstalk deploys supported application platforms while provisioning resources that still appear in your account. Lightsail offers simpler bundled infrastructure.
- On-Demand has no long-term usage commitment. Savings Plans exchange a spend commitment for eligible discounts. Reserved Instances apply reservation/discount rules to qualifying usage; regional and zonal EC2 reservations differ in flexibility and capacity benefit.
- Spot uses spare capacity that can be interrupted: favour resumable, flexible work. Dedicated Instances isolate tenancy from other customers; Dedicated Hosts expose a physical host allocation for host-level licensing or compliance requirements. Capacity Reservations reserve matching capacity and are not inherently a discount.
- Match architecture before price. A cheap interrupted instance can be an expensive choice for a non-resumable critical task. Stopping EC2 compute does not remove attached EBS, snapshots or other retained billable resources.
Choose under exam pressure
| Requirement | Choice and reason |
|---|---|
| Run an existing Kubernetes workload | EKS; select nodes or supported Fargate execution. |
| Interruptible batch processing | Spot with retry/checkpoint design. |
| Need access to the guest OS | EC2 rather than Lambda. |
Traps
- Fargate is compute, ECS/EKS are orchestrators.
- A commitment discount is not the same as a guarantee of capacity.
- Serverless means server management is abstracted, not that limits and charges disappear.
Active recall
1. Does an ALB automatically add EC2 instances?
No. It distributes requests; Auto Scaling manages fleet capacity.
2. A licence depends on physical host sockets. Which option should be evaluated?
Dedicated Hosts, subject to the licence terms.
3. A function needs to remember a cart across invocations. Where should it keep it?
In durable external storage such as DynamoDB, not execution-environment memory.
4. Which purchase model fits an unknown short experiment?
On-Demand, avoiding a long commitment.
5. Does terminating a task necessarily delete its database?
No. Resource lifecycles are separate; inventory retained resources.