0
0
AwsComparisonBeginner · 3 min read

Stop vs Terminate EC2 Instance: Key Differences and When to Use Each

Stopping an EC2 instance pauses it, preserving the instance and its data while stopping billing for compute. Terminating an EC2 instance deletes it permanently, removing all data and stopping all charges.
⚖️

Quick Comparison

This table summarizes the main differences between stopping and terminating an EC2 instance.

FactorStop InstanceTerminate Instance
Instance StateStopped (can be started again)Terminated (cannot be restarted)
BillingStops compute charges, storage charges continueStops all charges immediately
Data on Instance StoreLostLost
Data on EBS VolumesPreservedDeleted if "Delete on Termination" is true
Elastic IP AddressRemains associated if attachedReleased unless manually detached
Instance IDRemains the same when restartedInstance ID is not reused
⚖️

Key Differences

When you stop an EC2 instance, AWS shuts it down but keeps the instance's configuration and attached EBS volumes intact. This means you can start it again later with the same settings and data on EBS volumes. While stopped, you do not pay for compute time, but you still pay for storage of EBS volumes.

In contrast, terminate deletes the instance permanently. The instance ID is removed, and by default, the root EBS volume is deleted unless configured otherwise. You cannot restart a terminated instance. Termination stops all billing immediately, including compute and storage if volumes are deleted.

Stopping is like pausing a movie—you can resume watching later. Terminating is like deleting the movie file—you lose it completely.

⚖️

Code Comparison

Here is how you stop an EC2 instance using AWS CLI.

bash
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
Output
{ "StoppingInstances": [ { "InstanceId": "i-1234567890abcdef0", "CurrentState": { "Code": 64, "Name": "stopping" }, "PreviousState": { "Code": 16, "Name": "running" } } ] }
↔️

Terminate Equivalent

Here is how you terminate the same EC2 instance using AWS CLI.

bash
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0
Output
{ "TerminatingInstances": [ { "InstanceId": "i-1234567890abcdef0", "CurrentState": { "Code": 32, "Name": "shutting-down" }, "PreviousState": { "Code": 16, "Name": "running" } } ] }
🎯

When to Use Which

Choose stop when you want to pause your instance temporarily to save compute costs but keep your data and configuration intact for later use.

Choose terminate when you no longer need the instance and want to delete it permanently to avoid all charges and free up resources.

Key Takeaways

Stopping an EC2 instance pauses it and preserves data on EBS volumes but stops compute billing.
Terminating an EC2 instance deletes it permanently and stops all billing immediately.
Stopped instances can be restarted with the same instance ID; terminated instances cannot.
Data on instance store volumes is lost in both stopping and terminating.
Use stop for temporary pauses and terminate for permanent deletion.