EC2 is AWS's virtual server service. Instances can be created, started, stopped, and terminated on demand.
How EC2 Works
When creating an EC2 instance, you usually choose:
- AMI: operating system and preinstalled software
- Instance type: CPU, memory, and networking capacity
- Storage configuration
- Network and security groups
You can connect through SSH, RDP, or AWS Systems Manager.
Instance Types
General purpose: balanced compute, memory, and networking. Good for web services.
Compute optimized: high CPU workloads.
Memory optimized: large datasets, caches, and databases.
Accelerated computing: GPU or hardware acceleration.
Storage optimized: high I/O and local storage workloads.
Pricing Models
Common pricing options:
- On-Demand Instances
- Reserved Instances
- Savings Plans
- Spot Instances
Choose based on whether the workload is stable, interruptible, and long-running.
Auto Scaling and Load Balancing
Auto Scaling automatically adds or removes instances based on demand.
Elastic Load Balancing distributes traffic across multiple targets to improve availability.
Messaging Services
SQS is a queue service for decoupling producers and consumers.
SNS is a pub/sub service for pushing messages to multiple subscribers.
EventBridge supports event-driven architectures across AWS services and applications.
Deeper Notes
When reviewing this topic, do not memorize names only. Focus on EC2, Auto Scaling, ELB, queues, and architectural tradeoffs between compute services. If this stays at the definition level, it becomes hard to explain in interviews or apply in projects. A stronger way to study it is to place it in a concrete scenario: who calls it, where the input comes from, what happens on failure, and whether data or state can be processed twice.
- AWS review should connect services into architecture: entry point, compute, networking, storage, permissions, monitoring, and cost.
- For each service, ask what problem it solves, who operates it, and what the blast radius is when it fails.
- Both exams and real projects care about boundaries: Region vs AZ, managed vs self-managed, stateful vs stateless resources.
In a real project, use it as a decision framework: identify inputs, constraints, failure modes, and observability before choosing a specific tool or pattern. If a solution looks simple, keep asking whether it still works when scale grows, permissions change, recovery matters, and more people collaborate on it.
Practical Checklist
- Identify where this concept sits in the system: development-time constraint, runtime behavior, infrastructure capability, or collaboration workflow.
- Write one minimal working example and one failure example; only knowing the happy path is usually not enough.
- Record common misuses: edge cases, permission assumptions, performance assumptions, sync/async differences, or environment differences.
- Connect the concept to a project experience so that an interview answer can be grounded in real tradeoffs.
- End with one sentence about tradeoff: what it gives up and what it buys.
Self-Check Questions
- What core problem does this topic solve?
- What alternatives exist, and what are their costs?
- Where are the most likely edge cases?
- How would code, tests, or monitoring prove that it is reliable?
Applied Scenario
A practical way to study this topic is to place it inside a small SaaS deployment: users enter through a domain, CloudFront or a load balancer receives traffic, the app runs on EC2, ECS, or Lambda, databases and caches live in private subnets, logs go to CloudWatch, permissions are controlled by IAM, and static assets are stored in S3. For every AWS service, ask where it sits in this chain: entry, compute, network, storage, security, monitoring, or cost control.
Common Pitfalls:
- Memorizing service names without being able to draw the request path.
- Ignoring network boundaries and exposing databases publicly.
- Not estimating cost or failure blast radius.