Compute
Where code runs on AWS, from customer-managed virtual servers to functions AWS runs on demand, and how to pick between them.
What it is
Compute is the processing power that runs code: CPU, memory and the network around them. AWS offers it at several levels. At one end the customer rents a whole virtual server and manages everything on it. At the other end the customer hands AWS a function and AWS runs it only when needed.
This group covers Amazon EC2 in depth, because almost every other service builds on it, plus the compute services that sit around it: Elastic Beanstalk, AWS Batch, the hybrid and edge options, and Compute Optimizer. Containers (ECS, EKS, Fargate) and Lambda have their own groups later.
How the options compare
- Amazon EC2 provides virtual servers. The customer chooses the operating system, install the software, patch it and decide how many servers run. Most control, most work.
- AWS Elastic Beanstalk runs EC2 as a managed layer. The developer uploads the code; Beanstalk creates the servers, load balancer and scaling, which remain visible and changeable.
- Containers (Amazon ECS, Amazon EKS, AWS Fargate) run an app packaged as a container image. With Fargate there are no servers to manage at all.
- AWS Lambda runs a function when an event happens and bills by the millisecond. Nothing runs, and nothing is billed, when there's no work.
AWS Batch doesn't fit on that line: it's a job scheduler that runs batch jobs on EC2, Spot or Fargate capacity as a managed service.
Example
An online shop might use all of them. The legacy order system runs on EC2 because it needs a specific Windows version. The new storefront runs as containers on Fargate. Lambda resizes product photos when they're uploaded. Every night, AWS Batch rebuilds the product recommendations.
In this group
EC2 basics
EC2 basics
What an instance is, what gets chosen at launch, and user data.
Instance types
Families, naming, and how to pick the right size.
Security groups
The firewall around every instance, and the ports to know.
Connecting to EC2
SSH, EC2 Instance Connect, Session Manager and the EIC Endpoint.
Paying for EC2
Purchasing options
On-Demand, Savings Plans, Reserved, Spot, Dedicated, Capacity Reservations.
Spot Instances
Spare capacity at up to 90% off, interruptions, and fleets.
EC2 in depth
IP addressing
Private, public and Elastic IP addresses.
Placement groups
Cluster, spread, partition and precision time.
Elastic network interfaces
Virtual network cards that move between instances.
EC2 Hibernate
Stop an instance and keep what's in its memory.
AMIs
Machine images: create, copy, share, and golden AMIs.
More compute
Elastic Beanstalk
Upload code, get a running web app with scaling.
AWS Batch
Managed batch jobs at any scale, and Batch vs Lambda.
Hybrid and edge compute
Outposts, Local Zones, Wavelength and VMware on AWS.
Compute Optimizer
Right-sizing recommendations from real usage.
Which compute service for which job?
- Lift an existing server to AWS as it is, or full control of the OS is needed → EC2.
- A standard web app, and the team doesn't want to manage servers → Elastic Beanstalk.
- Microservices packaged as containers → ECS or EKS, on Fargate if no servers are wanted.
- Short tasks triggered by events (a file upload, an API call, a message) → Lambda.
- Large batch jobs that run for hours, such as nightly reports or simulations → AWS Batch.
- Must run in the customer's own data centre with AWS APIs → AWS Outposts.
Exam tips
- "Least operational overhead" usually rules EC2 out when a managed option works: Beanstalk, Fargate or Lambda.
- "Full control of the operating system", "specific licensing", "custom kernel" → EC2.
- "Runs longer than Lambda's limit", "needs a GPU", "any runtime in a Docker image" → Batch, ECS or EC2, not Lambda.
- "Lowest cost for fault-tolerant work" → Spot Instances, often through Batch or an Auto Scaling group.