What Is AWS EC2?
What Is Cloud Computing?
Before EC2, if you needed a server, you bought physical hardware, set it up in a data center, and managed it yourself. Cloud computing changes that — you rent virtualized compute resources from a provider (AWS, in this case) and only pay for what you use.
AWS is the largest cloud provider. EC2 is its flagship compute service.
What Is EC2?
Amazon EC2 (Elastic Compute Cloud) provides virtual servers — called instances — in AWS data centers around the world. An instance behaves exactly like a real server: you SSH into it, install software, run your application, and expose it to the internet.
"Elastic" means you can scale the number of instances up or down based on demand, manually or automatically.
Core Concepts
Instance
A virtual server running in the cloud. When you "launch an EC2 instance", you're provisioning a new virtual machine.
AMI (Amazon Machine Image)
An AMI is a pre-configured OS snapshot used to launch instances — similar to Docker images. AWS provides official AMIs for Ubuntu, Amazon Linux, Windows, and more. You can also create custom AMIs from your own configured servers.
Instance Type
Defines the hardware of your instance — CPU, memory, storage, and networking capacity. Examples:
| Type | Use Case |
|---|---|
t3.micro | Low-traffic apps, free tier eligible |
t3.medium | General-purpose web servers |
c5.large | CPU-intensive workloads |
r5.large | Memory-intensive workloads |
Security Group
A security group is a virtual firewall that controls traffic to and from your instance. You define rules like:
- Allow SSH (port 22) from your IP only
- Allow HTTP (port 80) from anywhere
- Allow HTTPS (port 443) from anywhere
Key Pair
EC2 uses key pairs (public/private keys) for SSH authentication instead of passwords. AWS stores the public key; you keep the private key (.pem file) to connect.
Elastic IP
By default, instances get a new public IP every time they restart. An Elastic IP is a static public IPv4 address you can attach to an instance so the IP stays consistent.
Region & Availability Zone
AWS operates in regions (geographic locations, e.g., us-east-1 for N. Virginia). Each region has multiple Availability Zones (AZs) — isolated data centers. Deploying across AZs protects against data center failures.
How EC2 Fits in AWS
Internet → Route 53 (DNS) → Load Balancer → EC2 Instance(s) → RDS (Database)
EC2 is rarely used in isolation. It typically connects to:
- RDS — managed relational database
- S3 — object storage for files/assets
- CloudFront — CDN for static assets
- Route 53 — DNS to point your domain to the instance
In upcoming sections, you'll launch your first instance and deploy a real application to it.