aws/ec2-terminate

Terminate EC2 Instance

Terminate one or more EC2 instances permanently.

aws
ec2
terminate
delete

Command

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

Explanation

Terminates one or more EC2 instances, permanently deleting them and associated ephemeral storage.

Common Use Cases

  • Removing unused resources
  • Cleaning up environments after tests

Best Practices

  • Enable termination protection on important instances
  • Backup important data before termination

Common Mistakes to Avoid

  • Accidental termination of critical instances
  • Not using termination protection

Troubleshooting

Problem: Instance not terminating

Solution: Disable termination protection using the console or CLI.

Examples

Terminate instance by ID

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