How to use Digital Ocean Reserved IPs when upgrading Ubuntu

Following on from my post about Digital Ocean Droplets not responding. I decided that I should upgrade my server to run on the latest version of Ubuntu, which at the time of writing is 22.04.

Provisioning a new server is the preferred way instead of doing an distro upgrade on your existing server as problems can arise from doing this. You can use Reserved IPs from DigitalOcean to minimise downtime when doing this.

Why should you use Reserved IPs when upgrading Ubuntu?

There are 2 main ways (when working with DigitalOcean) to handle switching traffic from one server to a new one, both involve DNS changes. The first is to create your new server and then update your DNS records to point to the new IP address assigned to the new server. You'll now have to wait for the records to propagate, which can take up to 72 hours in some cases. Most of the time it doesn't take this long, especially if you tinker with the TTL values. However if you want to avoid any downtime, there is a better way to achieve this.

The other way is to use Reserved IP addresses. You can look at the docs to get a better idea of how to use them, however if you've never used this feature before, it might be a little confusing on how to do it properly.

How to use Digital Ocean Reserved IPs to upgrade Ubuntu

If you want to switch to a new server either for an upgrade or for another reason. You can use this flow to help you plan out the steps:

  1. First provision your new server and get it set up as much as you can. If you have an SSL certificate active on the old server, you can copy over the files to the new server if you want to minimise any downtime.
  2. Go to the DigitalOcean dashboard and navigate to Reserved IPs. From here choose the droplet (the old server) you want to assign a reserved IP to. This will assign an additional IP address to your droplet.
  3. Update your DNS settings to point your website or service to the reserved IP address
  4. Wait for the DNS changes to fully propagate. I use a DNS Checker to monitor this. Your website won't go down during this time.
  5. When you are ready to switch, from the Reserved IPs page change the reserved IP to point to your new Droplet. This will switch the flow of traffic over immediately since your DNS changes will already be in effect.
  6. If you didn't copy over the SSL files from your old server, now is the time to setup your new SSL certificate as your users will see a certificate misconfiguration error if not.
  7. When you are happy that the switch has been successful, you can kill off your old server.

You can use this same method to keep switching over traffic to a new server, E.g. each time you want to upgrade Ubuntu to the latest version. Please bear in mind that you'll need to keep the reserved IP active at all times once you do this. If you don't want to use this anymore, you'll need to update your DNS records to point to the actual IP address of your Droplets instead.

More Posts