kmax
By:
kmax

Can you clone your instance

March 8, 2017 2.4k views
Server Optimization Ubuntu

Can you create a new instance from an existing one by cloning it at digitalocean?

3 Answers

@kmax

You can create a Snapshot of your Droplet and then use that Snapshot to deploy a new Droplet. In a sense, it's like cloning, but there's an extra step.

  • awesome! thanks!

    so we can create multiple versions of this server without having to set them all up separately. :)

    • @kmax

      Essentially, yes :-). You can take a Snapshot at any time, though one thing I like to mention is that the Snapshot service takes a live Snapshot of your Droplet in its current state.

      While this is perfect for creating images you can later deploy on-demand, it's not as feasible for some production servers -- specifically those that have database software installed.

      The reason for this is because the Snapshot service takes current state snapshots -- it does not shut down services. So if, for example, you have a MySQL server running and it's doing reads + writes, it is possible, and likely, that you may end up with an incomplete write if a snapshot happens to run while the write is taking place.

      That said, it's not really meant as a backup solution, but I like to make the above known to those who ask. While the chances of MySQL or similar being so slow to perform the write are pretty slim, it could be a fluke case and you need to account for it when taking a snapshot you may later want to reference.

      • Thank you so much for your time!

        We just want to use it so we dont have to reinstall our OS and all of our software every time we want to create a new instance.

You might be interested in using a tool like Packer. It lets you automate the creation of snapshots with configuration files.

I just wrote two tutorials that may be helpful:

  1. How to Create DigitalOcean Snapshots Using Packer on Ubuntu 16.04
  2. How to Create DigitalOcean Snapshots Using Packer on CentOS 7
Packer, by Hashicorp, is a command-line tool for quickly creating identical machine images for multiple platforms and environments. With Packer, you use a configuration file, called a template, to create a machine image containing a preconfigured...

I want to clone my droplet and you have answered that question now my second query is how my apps will work with the new droplet.

Have another answer? Share your knowledge.