Compute services provide the processing power (CPU and RAM) to run your applications.
1. Amazon EC2 (Elastic Compute Cloud)
Think of EC2 as renting a virtual computer in the cloud. You choose the OS, CPU, and RAM.
Instance Types:
- General Purpose: Balanced (good for web servers).
- Compute/Memory Optimized: Heavy math or massive databases.
- Accelerated Computing: GPUs for machine learning or 3D rendering
Root Device Types (Where does the OS/Data live?)
- Instance Store: Physically attached to the host server. Ephemeral (If the server reboots or crashes, all data is lost). Fast, but risky.
- EBS (Elastic Block Store): A virtual hard drive connected over the network. Persistent (Data survives reboots).
AMI (Amazon Machine Image)
The “blueprint” used to create the server.
It includes the OS and pre-installed apps. You can make your own Custom AMI to launch identical servers instantly.
2.EC2 Pricing Models (How to pay)
On-Demand
Pay by the second. No commitment. Most expensive, but most flexible. (Best for unpredictable, short-term apps).
Reserved Instances (RI)
Commit to 1 or 3 years for a massive discount (up to 72%).
Standard: Highest discount, cannot change instance type.
Convertible: Lower discount, but allows you to change instance families later.
Scheduled: Only runs during specific time windows you reserve.
Savings Plans
Similar to RIs, but more flexible. You commit to spending a certain dollar amount per hour ($/hr) across EC2, Lambda, or Fargate.
Spot Instances
Bid on AWS’s unused spare capacity. Up to 90% off! The Catch: AWS can reclaim the server with a 2-minute warning if they need it back. (Best for batch jobs that can be paused/restarted).
Dedicated Hosts
You rent an entire physical server. Most expensive. Used only for strict compliance or specific software licenses that require physical cores.
3.Higher-Level Compute (Less management)
Elastic Beanstalk (PaaS)
You upload your code (PHP, Python, Java), and AWS handles the servers, load balancing, and auto-scaling. You don’t manage the OS.
AWS Lambda (Serverless)
You upload snippets of code. AWS runs it only when triggered (e.g., an image is uploaded). You pay only for the milliseconds it runs. No servers to manage at all!
Containers
ECS: AWS’s native container orchestrator.
EKS: AWS’s managed Kubernetes service.
Fargate: Serverless compute for containers (you don’t manage the underlying EC2 servers).
App Runner: The absolute easiest way to deploy a containerized web app without knowing anything about infrastructure.
Scenario Spotlight
1. App running consistently for 5 years, need cost efficiency? ➔ All Upfront Reserved Instance (3 years).
2. Deploy a PHP app, no server experience, needs auto-scaling? ➔ Elastic Beanstalk.
3. Daily batch job that can be stopped and started safely? ➔ Spot Instances.