DigitalOcean recently introduced floating IPs that can be manually reassigned to any Droplet – what DigitalOcean calls a virtual machine – within a data center. While neither novel nor a standalone high-availability solution, this service fills a gap for the fast-growing cloud provider.
DigitalOcean describes a Floating IP as “a publicly-accessible static IP address that can be assigned to one of your Droplet.” This IPv4 address can be mapped to a different Droplet by using their API or Control Panel. DigitalOcean is positioning this service as a component of highly available solutions because it helps eliminate a single point of failure. Today, there is no built-in load balancer service offered by DigitalOcean so customers often stand up their own solution. But as DigitalOcean told The New Stack, a load balancer running on a single virtual machine creates risk.
DigitalOcean noticed some of its customers using a droplet as load balancers that would, in effect, direct traffic to any one of a number of application servers, each running in its own Droplet. This approach would work well for handling large amounts of traffic, though would fail spectacularly if, for whatever reason, the front-end load balancer itself would cease operating.
This service does not actually handle the automatic failover and IP re-mapping activity. DigitalOcean points out that developers need to manually initiate the re-mapping, or write a script that invokes the API when a failover condition is encountered.
It is important to note that the Floating IP does not automatically provide high availability by itself; a failover mechanism, which automates the process of detecting failures of the active server and reassigning the Floating IP to the passive server, must be devised and implemented for the setup to be considered highly available.
Image source: https://www.digitalocean.com/community/tutorials/how-to-use-floating-ips-on-digitalocean
To help with scripting scenarios, DigitalOcean offers a metadata service so that Droplets can see if they are mapped to a public IP. In addition to high availability scenarios, DigitalOcean highlights “application upgrades” as a use case for this new feature. Developers could create a new environment and move the Floating IP once the application was tested and ready for traffic.
The Floating IP is an additional (static) IP address that does not replace the original one assigned to a Droplet. The flow of traffic from the Floating IP to the connected Droplet happens through something DigitalOcean calls an anchor IP. Servers created before October 20th won’t have such an IP, and need to be manually re-configured to work with Floating IPs.
Network traffic between a Floating IP and a Droplet flows through an anchor IP, which is an IP address that is aliased to a Droplet's public network interface (
eth0
). As such, a Droplet must have an anchor IP before a Floating IP can be assigned to it. Droplets created after October 20, 2015 will automatically have an anchor IP.…
An anchor IP is only accessible to the Droplet that it belongs to, and to a Floating IP that is assigned to the Droplet. The implication of this is that the anchor IP is where you should bind any public services that you want to make highly available through a Floating IP. For example, if you are using a Floating IP in an active/passive load balancer setup, you should bind your load balancer services to their respective Droplet anchor IPs so they can only be accessed via the Floating IP address.
The feedback on this new service was extremely positive from the dozens of commenters on the DigitalOcean blog. Comments on Hacker News were mostly positive, but some lamented how DigitalOcean does key management for the service, the lack of support for IPv6 addresses, and not offering a cross-data center solution. One blogger thought that the solution was simply too basic and didn’t go far enough. Many of DigitalOcean’s competitors have some flavor of the same capability. AWS offers static Elastic IPs as well as an Elastic Load Balancer that handles the auto-failover and re-routing of traffic. Google offers local and global load balancing, and other cloud providers such as IBM, CenturyLink, and Microsoft offer load balancing services.
To coincide with the release of Floating IPs, DigitalOcean updated their API documentation, and published a set of tutorials to help developers get started:
- How To Use Floating IPs on DigitalOcean
- How To Set Up Highly Available HAProxy Servers with Keepalived and Floating IPs on Ubuntu 14.04
- How To Set Up Highly Available Web Servers with Keepalived and Floating IPs on Ubuntu 14.04
- How To Create a High Availability Setup with Heartbeat and Floating IPs on Ubuntu 14.04
Floating IPs are free to use, but DigitalOcean will charge you $0.006 per hour if you reserve an address but don’t use it.