Skip to content

Instantly share code, notes, and snippets.

@cole007
Last active November 22, 2023 16:54
Show Gist options
  • Save cole007/a413d49a041ee21a82fea6a8842493ad to your computer and use it in GitHub Desktop.
Save cole007/a413d49a041ee21a82fea6a8842493ad to your computer and use it in GitHub Desktop.
Digital Ocean internal migration - moving files between droplets over SSH/SCP

If you need to move a lot of files between DO server you can move these through SCP over the internal private Digital Ocean network.

NB both droplets need to be within the same region

To do this you need:

  1. enable private network for each droplet (if not done at creation, note the droplet needs to be off for this to be enabled once live)

  2. ensure that eth1 is enabled for both droplets if not already - see https://www.digitalocean.com/community/tutorials/how-to-enable-digitalocean-private-networking-on-existing-droplets

  3. scp files from the source server to the destination server are sent like:

    scp -r /srv/users/serverpilot/apps/XXX/public/resources root@11.22.33.44:/srv/users/serverpilot/apps/XXX/public

Note that you need to specify the source directory you want to move and the parent directory you want to move it to. If you moved ~/resources to ~/resources you would create a folder called ~/resources/resources in the destination location.

In above example 11.22.33.44 is the internal (private) IP address for the destination server. You can discover this through the DO admin area under settings or by SSH-ing into the destination server and typing ifconfig (the IP address will be the inet addr under eth1).

You will be prompted for the root password on the destination server, or the password for whatever user account you are using to access the destination server, e.g. root@, serverpilot@. etc. To avoid having to enter the password you can set up SSH keys by following the guide at https://www.digitalocean.com/community/tutorials/how-to-set-up-and-use-digitalocean-private-networking

Refs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment