EC2 instance lifecycle basics
Topic: Cloud aws core
Summary
EC2 instances move through pending, running, stopping, stopped, terminated. Use stop to save cost without losing EBS; terminate to delete. Use this when managing instance state and cost.
Intent: How-to
Quick answer
- Running is billed. Stop preserves EBS; no EC2 charge. Terminate deletes instance and optionally root EBS. Reboot keeps instance; brief downtime.
- Stop then start gives new public IP unless you use Elastic IP. Instance store is lost on stop for instance-store-backed.
- Use stop for dev or non-24/7. Use terminate for decommission. Schedule stop/start with Lambda or Instance Scheduler for cost savings.
Prerequisites
Steps
-
Stop and start
Stop instance from console or CLI. Start when needed. New public IP unless Elastic IP attached.
-
Reboot vs stop
Reboot keeps same instance and IP. Stop releases compute; start allocates new. Use stop for cost savings.
-
Terminate
Terminate when decommissioning. Set DeleteOnTermination on EBS if you want volume deleted. Backup first if needed.
Summary
EC2 instances move through pending, running, stopping, stopped, terminated. Stop to save cost; terminate to delete.
Prerequisites
Steps
Step 1: Stop and start
Stop instance from console or CLI. Start when needed. New public IP unless Elastic IP.
Step 2: Reboot vs stop
Reboot keeps same instance and IP. Stop releases compute. Use stop for cost savings.
Step 3: Terminate
Terminate when decommissioning. Set DeleteOnTermination on EBS if needed. Backup first.
Verification
- Instance state changes as expected. EBS preserved on stop. Terminate removes instance.
Troubleshooting
Cannot stop — Check instance store or constraints. Wrong EBS deleted — Check DeleteOnTermination.