📝

What is IP floating?

に公開

This blog is the English version of the following blog.
https://zenn.dev/mn87/articles/112b07f8f269ed

CDP:Floating IP Pattern - AWS-CloudDesignPattern

A static IP address used in Amazon Web Services (AWS) is known as an "Elastic IP Address (EIP)." You can use this to reassign IP addresses. You can detach an EIP from an existing EC2 instance and attach it to another ECP instance, to swap the virtual server that provides the services.

It seems that switching public IP addresses is referred to as IP floating.

Use Cases

  • In the event of a failure, switch to a different EC2 instance.
  • Temporarily switch to another EC2 instance when the server needs to be stopped, such as during a change in EC2 instance type.

The difference from failover routing

Active-active and active-passive failover - Amazon Route 53
With Route 53's failover routing, failure detection and automatic server switching are possible.

It seems that IP floating and failover routing differ in the following points.

For web servers, you can use the Domain Name System (DNS) to swap the server. However, in this case as well, typically the swapping time cannot be shortened to less than the Time to Live (TTL) value, so this is not suited to instant swapping.

In terms of switchover time, IP floating seems to be faster.
It also appears to have other advantages like these.

  • Since it only involves reassigning the EIP, the system switchover is not affected by DNS TTL.
  • During an upgrade, even if an error occurs on the switchover target server, you can immediately fall back by reassigning the EIP to the original server.
  • Because an EIP can be applied across different Availability Zones (AZs), it's possible to reassign it to a server in another AZ in case of an AZ-level failure.
  • EIP reassignment can be performed via API, so it can be automated in combination with monitoring software.

Personally, I felt that IP floating might help reduce costs since it eliminates the need to use an ELB. Of course, ELB is convenient because it's managed by AWS, but in terms of cost, IP floating seems like a viable alternative.

Note

  • Switching an EIP normally takes several seconds.
  • In a Virtual Private Cloud (VPC), you can create additional virtual network cards called an Elastic Network Interfaces, or ENIs. These will have a fixed IP addresses (note: the address is “fixed” (unchanging) from the infrastructure perspective, however from the operating system perspective it is a dynamic address). You can assign and then later move an ENI and its accompanying private address(es) and (if applicable) EIP(s) to another EC2 instance, enabling you to apply this pattern even within a private network. Note, however, that since their primary IP addresses are fixed, ENIs are by definition limited a single subnet inside of VPC.
  • When you make a Secure Shell (SSH) connection to a new instance behind an EIP, a potential security issue warning will be issued, and login may become impossible.

Even with EIP reassignment, there seems to be a brief disruption, so if it is to be adopted, thorough testing will be necessary, and a design that assumes such disruptions may also be required.

Summary

This time, I researched IP floating.
Here are the key points:

  • IP floating refers to reassigning a public IP.
  • It allows you to reassign an EIP to a different EC2 instance during failures, etc.
  • Since it is not affected by DNS TTL, the switchover is faster than failover routing.
  • It can be reassigned even across AZs.
  • Disruptions may occur.
  • Automatic reassignment via API is possible.

I think this method could be useful for improving availability or minimizing downtime during maintenance.
I hope this helps someone.

References

Discussion