How do I transfer an IP address between droplets?

October 30, 2014 6.3k views

If I have a droplet with an IP address which is already in use and wish to create a new droplet and transfer the IP address to that, how do I do that safely?

Presumably two droplets can't have the same IP address, and if I destroy the first droplet, doesn't that release the IP address back to the pool of unused DO addresses, in which case it might get allocated to another account?

6 comments
  • Why do you want to do this?

  • Maybe he has a test site and a production site and wants to be able to toggle between the two?

  • @jasonlough

    If that's the case he obviously needs to rethink his strategy seeing that there are easier ways to accomplish this.

  • I might want to build the first version of a site one way, and then get to grips with building/deploying it a better way, such as using the API which I would presume involves creating s separate droplet which I would switch to when that process was ironed out.

    Happy to hear what the better strategy is.

  • You can use git and use different branches if your code is similar enough. The deploying can be done with docker and put nginx on top of that to use virtualhosts. No need to create a whole new droplet, that workflow doesn't scale, even for one person.

  • I would check in the control panel because I do recall couple of weeks back or even more than that that you are able to migrate your IP.

    And the other option is way too complicated with using git. using a simple web hosting Control Panel you cannot spin that into a docker.

    Upgrading a droplet doesn't work. Adding extra RAM or CPU is all great but, you need to go in and change all your settings for mysql and bunch of other apps to take advantage of the extra RAM and CPU power.

    It is much easier to start with the bear OS, plenty of RAM and CPU power and after install your applications and then migrate your data along with your IP and when DNS takes up change you could kill your first droplet in your second falls into place

1 Answer

The short answer is no. You can not transfer an IP address between two droplets.

The slightly longer answer is that if you are trying to create a fresh droplet and want to retain the IP address, you have a few options. In the destroy tab, there is a rebuild option:

This "rebuilds" your droplet based on the selected image. It's important to note that this will destroy all of your data on the droplet, but it will retain the same IP address.

If you need to retain the data, you can take a snapshot and destroy the old droplet to release the IP address. Then create a new droplet based on the snapshot using the same hostname as the original droplet. The system will try and retain the IP address for you, but it is not guaranteed. The sooner you launch the new droplet, the more likely it is to work.

Have another answer? Share your knowledge.