CDP:Floating IP Pattern

From AWS-CloudDesignPattern
Jump to: navigation, search
Architect

Floating IP Address

Contents

Problem to Be Solved

You need to stop the server when applying a patch to a server, or when upgrading the server (to increase the processing capabilities). Because stopping a server stops the services it provides, you need to to minimize the downtime.

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.

Explanation of the Cloud Solution/Pattern

With the physical servers of the past, you would have to provide a spare server to prepare for taking down a server. After you had taken down the actual server, you would have to start up the spare server to take over processing. You would have to set up the IP address (to that of the actual server).

You can achieve this easily and extremely quickly through the AWS Cloud. You can prepare a machine image that will enable you to start up the required virtual server whenever you need it. Moreover, because an API for specifying the IP address is also available, you can write a script to automate all the processes from starting up the server through setting the IP address.


Implementation

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.

(Procedure)

  • Assign an EIP to an EC2 instance.
  • When there is a failure or when you are going to perform an upgrade, launch a new EC2 instance. You can use the Stamp Pattern when launching the new EC2 instance. You can perform the swap more rapidly by launching the other EC2 instance in advance.
  • After launching the instance, detach the EIP from the current EC2 instance and attach it to the new EC2 instance.


One of the implementation example is http://stevemorad.s3.amazonaws.com/reInvent/demos/vip_template.htm. It was demoed during the AWS re:Invent CPN207 - Virtual Networking in the Cloud session will enable one EC2 instance to monitor another EC2 instance and take over a private "virtual" IP address on instance failure.

Configuration

2XNdewVsgellO3x8-01890.png

Benefits

  • You can swap servers by merely reassigning the EIP, unaffected by the TTL of the DNS.
  • When performing an upgrade, you can achieve instantaneous fall-back through assigning the EIP back to the original server in the event of an error in the server to which the EIP had been swapped temporarily.
  • Because you can apply EIPs across different Availability Zones (AZs), even if there were a failure on an AZ level, you can reassign the EIP to a server in a different AZ.

Cautions

  • 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.

Other

  • You may use monitoring software such as HeartBeat, Nagios, or Zabbix to detect a failure. Because you can use a program to perform the EIP reassignment, you can automate this process through a combination with the monitoring software.
  • You can use this in parallel with Server Swapping Pattern to not only reassign the EIP, but to swap the EBS as well, enabling data inheritance.
  • There is also a technique for switching to a spare server using Elastic Load Balancing (ELB) without using the EIP, by adding or deleting a health check file.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox