States and effects
A common flow is pending → running → stopping → stopped. Termination goes through shutting-down → terminated and cannot be undone. Stop preserves EBS but loses Instance Store data; root EBS deletion on termination follows DeleteOnTermination.
flowchart LR P["pending<br/>booting"] --> R["running<br/>billed"] R --> SP["stopping"] SP --> S["stopped<br/>EBS kept, no compute bill"] S --> P R --> SD["shutting-down"] SD --> T["terminated<br/>cannot undo"] %% step P: The instance is placed on a host and boots. %% step R: Running instances are billed per second (Linux, after the first minute). %% step SP: A stop shuts the OS down cleanly. %% step S: Stopped instances keep their EBS volumes, which are still billed; instance store data is gone. %% step SD: Termination deletes the instance and, by default, its root volume. %% step T: A terminated instance cannot be started again.
| Action | Instance store | EBS root | Public IP | Elastic IP | Host |
|---|---|---|---|---|---|
| Reboot | Kept | Kept | Kept | Kept | Same |
| Stop / start | Lost | Kept | New one | Kept | Usually new |
| Hibernate | Lost | Kept (RAM saved to it) | New one | Kept | Usually new |
| Terminate | Lost | Deleted if DeleteOnTermination | Released | Disassociated | — |
Turn on termination protection for important instances so an accidental terminate call fails.
Scaling
Vertical scaling changes the instance type and normally requires a stop. Horizontal scaling changes the number of instances, with a Load Balancer and Auto Scaling — the cloud-native way to add capacity without downtime.
Troubleshoot by layer
SSH times out (no answer at all) — a network problem:
1. Is the instance running and are status checks passing?
2. Does it have a public IP, and does its subnet route 0.0.0.0/0 to an IGW?
3. Does the Security Group allow port 22 from your IP?
4. Does the Network ACL allow 22 inbound and ephemeral ports outbound?
Permission denied (publickey) — you reached sshd: check the username, the key file, and its 400 mode.
Status checks
- System status check — AWS infrastructure: host hardware, power, network. Fix by stop and start, which moves the instance to a new host (a reboot does not).
- Instance status check — the guest: OS boot, kernel, full disk, wrong network config. Read the system log or take an instance screenshot, then fix the OS.
- Attached EBS status check — problems reaching an attached volume.
A CloudWatch alarm on StatusCheckFailed_System can recover an instance automatically onto new hardware, keeping its ID, IPs and EBS volumes.
| Command | Purpose |
|---|---|
aws ec2 stop-instances --instance-ids i-0123456789abcdef0 |
Stop an instance |
aws ec2 start-instances --instance-ids i-0123456789abcdef0 |
Start it again |
aws ec2 describe-instance-status --include-all-instances |
View status checks |
aws ec2 get-console-output --instance-id i-0123456789abcdef0 |
Read the boot log |
Traps: rebooting to fix a failed system check; expecting the same public IP after stop/start; treating a timeout as a key problem.