Virtual Servers

Amazon EC2

Amazon Elastic Compute Cloud

Amazon EC2 provides secure, resizable compute capacity in the cloud. It lets you launch virtual servers in minutes, with complete control over your computing environment.

Overview

What is Amazon EC2?

EC2 is the foundational compute service of AWS, providing virtual machines known as "instances."

Introduction

Launched in 2006, Amazon EC2 changed the way companies think about infrastructure. Instead of buying physical servers and waiting weeks for delivery, you can launch a virtual server in minutes. You choose the operating system, CPU, memory, storage, and network performance — and you pay only for what you use.

EC2 instances run on physical hosts managed by AWS. Multiple instances (from different customers) may run on the same physical server, but they are isolated using the Xen hypervisor. This multi-tenant model is what makes cloud computing cost-effective.

Instance Types

EC2 Instance Types

Choose the instance that fits your workload.

FamilyNameUse CasevCPU / Memory
General Purposet3, m7gWeb servers, small databases2-48 vCPU / 8-192 GB
Compute Optimizedc7g, c6iBatch processing, gaming4-64 vCPU / 8-128 GB
Memory Optimizedr7g, x2idnIn-memory caches, SAP4-128 vCPU / 32-4096 GB
Storage Optimizedi4i, d3Data warehousing, log processing4-64 vCPU / 32-512 GB
GPU Instancesp5, g5ML training, video rendering8-192 vCPU / 32-2048 GB
Architecture

How EC2 Works

From AMI to running instance.

EC2 Launch Flow — Step by Step
1

Choose AMI

Select OS — Amazon Linux, Ubuntu, Windows, etc.

2

Pick Instance Type

Choose vCPU, memory — t3.micro, m5.large, etc.

3

Configure Security

Security Groups, Key Pair, VPC placement

4

Add Storage

Attach EBS volumes — gp3, io2, or instance store

5

Launch & Connect

SSH or RDP into your new instance

Pricing Options: On-Demand — pay by the hour/second (flexible). Reserved — 1-3 year commitment saves up to 72%. Spot — up to 90% off but can be terminated if AWS needs capacity back.

Key Concepts

AMI (Amazon Machine Image): A template that contains the OS, software, and configuration. You can use AWS-provided AMIs, marketplace AMIs, or your own custom AMIs.

Security Groups: Virtual firewalls that control inbound and outbound traffic. You can allow SSH (port 22), HTTP (port 80), or restrict access to specific IPs.

Key Pairs: SSH key pairs (.pem files) for secure access to Linux instances. Windows instances use admin passwords encrypted with the key pair.

Features

Key Features

Why EC2 is the most popular cloud computing service.

Elasticity

Scale up or down in minutes. Combine with Auto Scaling to automatically adjust capacity based on demand.

Flexible Pricing

On-Demand, Reserved, Spot Instances, and Savings Plans — choose the best pricing model for your workload.

Security

Integrates with VPC, IAM, Security Groups, and NACLs. Encrypt data with AWS KMS. Achieve compliance certifications.

Global Presence

Available in 30+ regions and 100+ availability zones worldwide. Deploy close to your users for low latency.

Elastic Block Store

Persistent block-level storage volumes for EC2. SSD and HDD options available. Snapshots for backup.

Load Balancing

Distribute traffic across multiple Availability Zones for high availability.