Three Ways to Clone your Compute Instance in Oracle Cloud Infrastructure

We would need to clone our compute instances for test and development reasons or to implement a high availability and disaster recovery solution.

In this blog post we will have a look at three ways to duplicate an existing compute instance in Oracle Cloud Infrastructure. To do so we need to duplicate the Boot Volume, and if any, the attached Block Volumes.

Cloning

cloned volume is a point-in-time direct disk-to-disk deep copy of the source volume. All data on the source volume is copied to the clone volume. Cloning enables you to make a copy of an existing boot or block volume without going through the backup and restore process.

  1. Create a Volume Group to make the cloning process easier and to have a time-consistent copy of all volumes together.
  2. Clone the volume group.
  3. Create a new compute instance from the cloned boot volume.
  4. Attache the cloned block volumes to the newly created compute instance.
No alt text provided for this image

The cloned volumes will reside in the same Availability Domain as the source volumes and the new compute instance can only be created in that specific Availability Domain.

Cloning is suitable for rapidly duplicating an environment for testing purposes.

Backup & Restore

Boot and block volume backups are a point-in-time backup of data to Object Storage.

There are two backup types available:

  • Full: includes all changes since the volume was created.
  • Incremental: includes only the changes since the last backup.

You can restore the backups when needed as new volumes to any Availability Domain within the same region.

  1. Create a Volume Group to make the cloning process easier and to have a time-consistent copy of all volumes together.
  2. Backup the volume group. The Backup will reside on Object Storage.
  3. Restore the volume group from the volume group backup.
  4. Create a new boot volume and block volumes from the restored backups.
  5. Create a new compute instance from the newly created boot volume.
  6. Attache the newly created block volumes to the new compute instance.
No alt text provided for this image

For disaster recovery scenarios, copy the backups to a second region and restore them in that second region in case of a disaster.

No alt text provided for this image

To automate the backup process, assign a backup policy to the volume or volume group. You can use an Oracle Defined Backup Policy or create a User Defined Backup Policy. With user defined policies, you can also enable scheduled cross-region backups, so that scheduled volume backups are automatically copied to a second region.

Backups are suitable to recover from an outage, for disaster recovery, and to meet compliance and regulatory requirements as they can be used as data archive.

Custom Images

OCI uses images to launch instances. The image can be specified at instance creation. You can create a custom image of an instance’s boot volume and use it to launch other instances. A custom image includes the customizations, configuration, and software installed when you create the custom image. It does NOT include any data from attached block volumes. Attached block volumes have to be replicated via cloning or backup & restore. The instance will be taken offline for several minutes during custom image creation.

  1. Create a custom image.
  2. Create a new instance using the newly created custom image.
No alt text provided for this image

Custom images can be shared across tenancies and regions using image export and import.

  1. Create a custom image.
  2. Export the custom image to Object Storage.
  3. Copy the custom image on Object Storage to the second region.
  4. In the second region, import the custom image from Object Storage.
  5. Create a new instance using the newly imported custom image.
No alt text provided for this image

Custom images are suitable to maintain a copy of the boot volume including all configurations and software installed at that point in time for no additional cost.

Conclusion

Volume clones are a fast option to duplicate an instance in the same availability domain for testing purposes. Custom Image creation require a downtime, and does include the boot volume only.

Block volume backups have many advantages:

  • Can be grouped to volume groups to simplify backup and restore process.
  • Can be automated using Oracle or user defined backup policies.
  • Backup is an online operation without any service interruption.
  • Lower cost as stored on Object Storage. Suitable for archiving.
  • Backup can be incremental to keep the backup size as small as possible.
  • Can be restored to other availability domains and copied across regions for disaster recovery scenarios.
No alt text provided for this image

So backups seem to be the winner in this racing 🙂

Would you like to get notified when the next post is published?