SimAWSby ShahriarLabs
Search

Virtual machines · Chapter 1 of 2

How EC2 instances manage execution state

Renting a virtual machine means managing its lifecycle, but knowing what survives a stop, start, or termination helps you design resilient compute while keeping costs down.

13 min2 sectionsBack to Virtual machines

FoundationsBuilds the idea from nothing. No prior AWS assumed.

Understanding stopped and terminated states

What are the practical differences between stopping and terminating an instance?

EC2 Host NodeAPI ControlEC2 APIInstancet3.microInstance StoreNVMe TemporaryEBS Root Volumegp3 PersistentStopping an EC2 instance erases ephemeral instance store data, while terminating deletes the EBS root volume unless configured otherwise.

Instance launches into running state attached to local instance store and EBS root volume.

1/5
  1. 01

    Stopping is a pause

    When you stop an EC2 instance, the underlying physical host releases the virtual machine. The operating system performs a clean shutdown, and the CPU and RAM allocation are freed. The data on your attached EBS volumes is preserved, and you can start the instance again later.

  2. 02

    Termination is permanent deletion

    Terminating an instance is a destructive operation. The virtual machine is destroyed, and the attached root EBS volume is deleted by default. Any local data that has not been backed up or stored on a persistent volume is permanently lost.

  3. 03

    The volatile public IP address

    When an instance stops, it relinquishes its public IP address back to the AWS pool. When started again, it receives a new public IP. If your application relies on a static IP address, you must assign an Elastic IP or place a load balancer in front of the instance.

Check yourself

You stop an EC2 instance that runs a web server. When you start it again, client connections fail. What is the most common reason?

Under the hoodThe same thing from underneath: limits, failure modes, numbers.

The billing and physical details of lifecycle changes

Why does an idle, stopped instance still generate charges on your bill?

EC2 Host NodeAPI ControlEC2 APIInstancet3.microInstance StoreNVMe TemporaryEBS Root Volumegp3 PersistentStopping an EC2 instance erases ephemeral instance store data, while terminating deletes the EBS root volume unless configured otherwise.

Instance launches into running state attached to local instance store and EBS root volume.

1/5
  1. 01

    Stopped instances are not free

    While a stopped instance does not incur compute charges, you are still billed for the resources that support it. The root EBS volume continues to occupy physical disk space in the Availability Zone and is billed at standard storage rates.

  2. 02

    Instance store versus EBS

    Instances can use EBS volumes or physical disk drives attached to the host server, known as instance store. Instance store provides high performance but is ephemeral. If the instance is stopped, rebooted, or the host fails, all data on the instance store is lost.

  3. 03

    Elastic IP addresses carry a cost

    To keep a public IP static across stops and starts, you allocate an Elastic IP. To prevent IP wasting, AWS charges a penalty fee for any Elastic IP that is allocated but not attached to an active, running instance.

The numbers

Compute charge while stopped
$0.00You only pay for compute capacity when the instance is running.
EBS storage charge while stopped
Standard rates applyA 100 GB volume costs the same whether the instance is stopped or running.
Unattached Elastic IP fee
$0.005 per hourAWS charges this fee to discourage IP hoarding when instances are stopped.
Instance store persistence
Survives reboot onlyStopping or host hardware failure permanently erases instance store data.

Check yourself

An instance store volume is attached to an EC2 instance. The instance is stopped for maintenance and restarted. What happens to the data on the instance store?

Official references & further reading

These lessons simplify selected behaviors for learning. Verify current service limits, Region support and production requirements with the official references. Experiments describe their own assumptions.

Report an error or suggest a clearer explanation →