# Terminate an instance

Terminate an instance permanently, and learn which of its volumes, network interfaces and addresses are deleted and which stay with you.

Terminate an instance when you no longer need it. Termination is permanent and stops billing for the instance. The volumes its launch created are deleted with it, unless a volume has a snapshot: then it stays, and it’s still billed. See [What happens to the instance’s resources](#what-happens-to-the-instances-resources).

## Before you begin [#before-you-begin]

<BeforeYouBegin>

- Copy off any data you need from the instance’s root disk. The root disk and every other volume the launch created are deleted with the instance, and there is no option to keep them.
- Detach any volume you want to keep using elsewhere, or let termination release it. Volumes you attached yourself are never deleted. See [Attach and detach volumes](/docs/compute/instance-storage/attach-detach).

</BeforeYouBegin>

<Callout type="warning" title="Important">

Termination can’t be undone. The instance, its root disk and its launch-created network interface are gone for good.

</Callout>

## Terminate the instance [#terminate-the-instance]

1. Request the termination:

   ```sh
   origin compute terminate-instance --instance-urn <instance-urn>
   ```

   You can terminate an instance in any status. A `FAILED` instance is terminated without waiting for its machine to confirm the guest is gone.

1. Run `get-instance` until `status` reads `TERMINATED`:

   ```sh
   origin compute get-instance --instance-urn <instance-urn>
   ```

   The instance passes through `SHUTTING_DOWN` while its resources are released, normally for a few seconds.

Terminating is safe to repeat. If you aren’t sure an earlier attempt went through, call it again. Terminating an instance that is already `TERMINATED` reports success and changes nothing.

## What happens to the instance’s resources [#what-happens-to-the-instances-resources]

| Resource | On termination |
| --- | --- |
| Root disk and other launch-created volumes | Deleted. |
| Volumes you attached yourself | Detached and `AVAILABLE` again. Not deleted. |
| Launch-created network interface | Deleted, with any public address the platform assigned to it automatically. |
| Floating IP you allocated yourself | Disassociated. It stays allocated to you until you release it. See [Floating IPs](/docs/network/internet-access/floating-ips). |

A launch-created volume that has a snapshot can’t be deleted, so it stays `AVAILABLE` and billed after the instance terminates. Its `retentionNote` says why. Delete the snapshots, then the volume. See [Delete a volume](/docs/storage/volumes/delete).

If something else can’t be released, the instance still reaches `TERMINATED` and stops costing you anything. The attachment for that resource keeps naming it and says it could not be released.

A terminated instance stays in `list-instances` for 2 hours, then drops out of the default list. You can still read it with `get-instance` at any time.

## Using the API [#using-the-api]

```graphql
mutation {
  compute {
    terminateInstance(input: { instanceUrn: "<instance-urn>" }) {
      accepted
      message
    }
  }
}
```

## Related [#related]

- [`terminate-instance` reference](/docs/compute/reference/cli#terminate-instance)
- [Instance lifecycle](/docs/compute/instances/lifecycle)

