Compute services
Choose between EC2, containers, Lambda and the simpler hosting services, and explain Auto Scaling and load balancing.
16 min
Amazon EC2 (Elastic Compute Cloud) gives you virtual servers called instances. You pick an AMI (the image: OS plus software), an instance type (CPU, memory, storage and network), storage and a security group. You manage the guest OS.
Instance types are grouped in families:
- General purpose: balanced CPU and memory (web servers, small databases).
- Compute optimized: high CPU (batch processing, gaming, media encoding).
- Memory optimized: lots of RAM (in-memory databases, big caches).
- Storage optimized: fast local disk throughput (data warehouses, high I/O databases).
- Accelerated computing: GPUs and chips for machine learning and graphics.
Elastic Load Balancing (ELB) spreads traffic across instances in several AZs. Amazon EC2 Auto Scaling adds or removes instances based on demand and replaces unhealthy ones. Together they give you elasticity and high availability.
AWS Lambda runs your code in response to events with no servers to manage. You pay per request and per millisecond of run time, and not at all when idle. A single invocation can run for up to 15 minutes, so Lambda is not for long, always-on jobs.
Pick the compute model by how much you want to manage.
Amazon EC2
- You manage
- OS, patching, scaling setup
- Billing idea
- Per second or hour while running
- Typical use
- Full control, any software
Best for Lift and shift, custom needs
Containers (ECS, EKS, Fargate)
- You manage
- Container images and app
- Billing idea
- Per resources used
- Typical use
- Microservices, portable apps
Best for Packaged apps
AWS Lambda
- You manage
- Just the function code
- Billing idea
- Per request and duration
- Typical use
- Event-driven code, short tasks
Best for Serverless back ends
Elastic Beanstalk
- You manage
- Your application code
- Billing idea
- The underlying resources you use
- Typical use
- Deploy a web app quickly
Best for Developers who want less ops
Quick reference
Amazon ECS
- What it is
- AWS's own container orchestration service
Amazon EKS
- What it is
- Managed Kubernetes
AWS Fargate
- What it is
- Serverless compute for containers: no servers to manage for ECS or EKS
Amazon ECR
- What it is
- Registry to store container images
AWS Elastic Beanstalk
- What it is
- Upload your code and AWS handles deployment, scaling and load balancing
Amazon Lightsail
- What it is
- Simple, predictable-price virtual servers and websites for small projects
AWS Batch
- What it is
- Runs large batch computing jobs
AWS Outposts
- What it is
- AWS infrastructure in your own data center
Pick the compute option.
A team wants to run image-resize code only when a photo lands in a bucket. It should cost nothing when no photos arrive.
“Lambda can run anything for as long as I need.”
Serverless sounds limitless.
What is actually true
A Lambda function has a maximum run time of 15 minutes per invocation. Long-running or always-on workloads belong on EC2 or containers.
- EC2 gives you virtual servers and you manage the OS. Choose the instance family by the workload.
- ELB spreads traffic. Auto Scaling adds and removes instances.
- Lambda is event-driven, pay-per-use and limited to 15 minutes per run.
- Fargate runs containers without servers. Elastic Beanstalk deploys apps. Lightsail is for simple projects.
Choose the compute service.
Which EC2 instance family is best for an in-memory database that needs a lot of RAM?
- AMemory optimized
- BCompute optimized
- CStorage optimized
- DGeneral purpose
Which service automatically adds or removes EC2 instances as demand changes?
- AAmazon EC2 Auto Scaling
- BAmazon Lightsail
- CElastic Load Balancing
- DAWS Lambda
Which service lets you upload application code and have AWS handle deployment, capacity and load balancing?
- AAWS Elastic Beanstalk
- BAWS Batch
- CAmazon EC2
- DAmazon ECR
An AWS Lambda function can run for a maximum of minutes per invocation.
Capitalisation, spacing and punctuation are ignored when grading.
Which TWO services run containers?
- AAmazon ECR
- BAWS Lambda layers
- CAmazon Lightsail only
- DAmazon ECS
- EAmazon EKS
Practise this lesson, not just read it
In BiliMind the questions above are marked when you answer, the flashcards come back on a schedule, and the rest of AWS Certified Cloud Practitioner (CLF-C02) is planned around your week. Free.