AWS EC2
Learn how Amazon EC2 provides virtual machines in the cloud and how AMIs, instance types, storage, and pricing models affect deployments.
Amazon EC2 is AWS’s core virtual machine service. If you have managed Linux or Windows servers before, EC2 will feel familiar: you choose an operating system image, CPU and memory size, networking, storage, and access settings, then boot a machine in the cloud. EC2 remains important because it gives you high flexibility for custom runtimes, legacy apps, lift-and-shift migrations, and workloads that need full operating system access.
EC2: Instance Lifecycle
Stopped instances retain their EBS root volume — you only stop paying for compute
Three building blocks show up in almost every launch. An AMI, or Amazon Machine Image, defines the starting disk image and may include the OS, base packages, and hardened configuration. The instance type defines compute characteristics such as vCPU, RAM, network bandwidth, and sometimes local NVMe storage. EBS volumes provide persistent block storage that survives instance stops and can be resized, snapshotted, and encrypted.
| Pricing model | Best fit | Trade-off |
|---|---|---|
| On-Demand | Unpredictable or short-lived workloads | Highest unit price |
| Reserved Instances or Savings Plans | Steady usage over time | Commitments reduce flexibility |
| Spot Instances | Fault-tolerant batch and stateless jobs | Can be interrupted |
EC2 also teaches good infrastructure habits. You decide which subnet the instance uses, what security groups allow traffic, whether a public IP is attached, and which IAM role the instance can assume. That means EC2 is a natural place to practice network isolation and least privilege rather than treating compute as a black box.
Many newer AWS services abstract away server management, but understanding EC2 makes the rest of AWS easier. Containers often run on EC2-backed clusters. Build agents, bastion hosts, and self-managed databases still rely on it. Even when you choose serverless tools later, knowing what EC2 gives you helps explain why those higher-level services behave the way they do.
Continue with AWS EC2 Launch Instance, AWS EC2 Instance Types, AWS EC2 Security Groups, and AWS EC2 Key Pairs.
aws ec2 describe-instance-types --instance-types t3.micro m5.large c5.large --output table
aws ec2 describe-images --owners amazon --query 'Images[0:5].[ImageId,Name]' --output table
Operational note
Treat EC2 instances as managed infrastructure, not pets. Capture launch settings in infrastructure as code, keep bootstrap steps repeatable, and monitor CPU, memory, disk, and patch level from the start. That way replacing an instance is a routine operation instead of a risky manual repair exercise. Shared standards like this make future environments easier to launch, review, and support.
EC2 basics
What does an AMI provide when launching an EC2 instance?
EC2 pricing
Which EC2 pricing option is best suited for interruptible batch workloads?