aws/ec2-stop

Stop EC2 Instance

Stop one or more EC2 instances.

aws
ec2
stop

Command

aws ec2 stop-instances --instance-ids i-1234567890abcdef0

Explanation

Stops one or more EC2 instances. Data on attached EBS volumes is preserved.

Common Use Cases

  • Reducing costs by stopping unused instances
  • Pausing environments between deployments

Best Practices

  • Stop dev/test instances during non-working hours
  • Use `--hibernate` to preserve memory state (supported types only)

Common Mistakes to Avoid

  • Assuming stop deletes the instance (use terminate for that)
  • Trying to stop spot instances (they must be terminated)

Troubleshooting

Problem: Instance stuck stopping

Solution: Check CloudWatch logs or AWS console for dependencies.

Examples

Stop instance by ID

aws ec2 stop-instances --instance-ids i-1234567890abcdef0