Home / OCI

OCIRunbookAdvanced

Sev1: production OCI instance terminated by mistake — bring it back from the boot volume or backups

Recover after an OCI compute instance is terminated. Check whether the boot volume was preserved, relaunch from it or from a backup, reattach block volumes, restore the private IP and DNS, and protect instances from the next accidental terminate.

Deepak Bhardwaj2 min read

Applies toOCI Compute, Block Volume and boot volume backups, OCI CLI 3.x

1. What survived?

# Preserved boot volumes are AVAILABLE and unattached
oci bv boot-volume list --compartment-id $C --availability-domain $AD \
  --query 'data[?"lifecycle-state"==`AVAILABLE`].{name:"display-name", id:id, created:"time-created"}' --output table

# Block volumes are never deleted by an instance terminate — they're just detached
oci bv volume list --compartment-id $C --availability-domain $AD --lifecycle-state AVAILABLE --output table

# Backups
oci bv boot-volume-backup list --compartment-id $C --query 'data[].{name:"display-name", id:id, t:"time-created"}' --output table
Found Path
Preserved boot volume Step 2 — fastest, no data loss on the OS disk
Boot volume gone, backup exists Step 3 — data as of the backup
Nothing Rebuild from image + IaC; restore app data from block volumes or backups

2. Launch from the preserved boot volume

Capture the old instance's details from the Audit log (TerminateInstance event) or your IaC: shape, OCPUs/memory, subnet, NSGs, private IP, hostname label.

oci compute instance launch --availability-domain $AD --compartment-id $C \
  --shape VM.Standard.E5.Flex --shape-config '{"ocpus":4,"memoryInGBs":64}' \
  --source-boot-volume-id <boot-volume-ocid> \
  --subnet-id <subnet-ocid> --private-ip 10.0.1.25 --nsg-ids '["<nsg-ocid>"]' \
  --display-name app01 --hostname-label app01 --wait-for-state RUNNING

Launch in the same availability domain as the boot volume.

3. Restore from a backup

oci bv boot-volume create --boot-volume-backup-id <backup-ocid> --availability-domain $AD \
  --compartment-id $C --display-name app01-boot-restored --wait-for-state AVAILABLE

Then launch from it as in step 2. Backups can be restored into a different AD in the same region if the original AD has capacity problems.

4. Reattach block volumes

oci compute volume-attachment attach --instance-id <new-instance-ocid> --volume-id <data-volume-ocid> \
  --type paravirtualized --device /dev/oracleoci/oraclevdb --wait-for-state ATTACHED

Use the same consistent device path as before so /etc/fstab entries still match. For iSCSI attachments run the attach commands shown in the console (or let the Oracle Cloud Agent Block Volume Management plugin do it).

5. Network identity

  • Reusing the old private IP keeps most integrations working. If it's taken, update DNS records and allow-lists.
  • A reserved public IP can be reassigned to the new VNIC's private IP; an ephemeral public IP is gone.
  • Load balancer backend sets: add the new instance's IP.

6. Verify

Services up, app smoke test, monitoring agent reporting, backup policy reassigned to the new boot volume:

oci bv volume-backup-policy-assignment create --asset-id <new-boot-volume-ocid> --policy-id <gold-policy-ocid>

Prevent it next time

  • Always terminate with boot volume preservation unless you mean it; in the CLI, pass --preserve-boot-volume true explicitly in scripts.
  • IAM: separate INSTANCE_DELETE permission from day-to-day operator groups.
  • Tag production instances and add a policy condition denying delete on them except for a break-glass group.
  • Backup policies on every boot and block volume.