Terminate an instance
Delete an instance's machine and its root disk, and later remove its record from the list.
Replace i-3f9a2c07 with your instance's id.
Warning
The machine and its root disk are deleted and cannot be recovered. Take a machine image first if you need a copy.
Prerequisites
- Permission for
ec2:TerminateInstances. - In the console, also
ec2:DescribeInstancesto open the instance's page (without it the page is not found). - In the console, the instance is not
pending,stopping,shutting-downorrebooting; until it settles, Terminate instance is unavailable with the reason. - An instance that is a node of a Kubernetes cluster is refused with
409"This instance is node … of the Kubernetes cluster …. Scale or delete its node group instead."
Terminate
- Open the instance, then choose Danger zone (or Terminate instance in the ⋯ menu).
- Under Terminate this instance, choose Terminate instance.
- Enter the instance name, then choose Terminate.
dcloud ec2 instances terminate i-3f9a2c07DELETE /ec2/api/instances/i-3f9a2c07Remove the dcloud_instance resource and run terraform apply.
Result
The instance goes to shutting-down while the machine is deleted, then terminated. An instance
whose machine did not exist yet goes straight to terminated. When it is terminated:
- Volumes made with the instance (
volumesat launch, withdeleteOnTermination) are deleted. Every other attached volume is detached and becomes Available. - An associated elastic IP is disassociated and stays allocated (and metered) until you release it.
- Its security group links are removed.
Instance hours stop with the termination. If deleting the machine fails at the provider, the
instance shows stopping with the error on its page; terminate it again with the CLI or API
(the console waits while it is stopping).
A machine of an auto scaling group that you terminate here is replaced by the group.
Remove the record
A terminated instance stays in the list. To remove it, terminate it once more: in the console,
open Danger zone, under Delete this instance record choose Delete record, enter the
name and choose Delete record; with the CLI or API, a second terminate or DELETE. A record already removed answers 400 "Instance record is already deleted".