EIPs are public IPv4 addresses that you can allocate to your account. You can then associate them with instances or network interfaces, in the public Cloud or in a VPC. The EIP enables communication with the Internet. For more information, see About VPCs > IP Addressing and Access to Internet.
To associate an EIP in a VPC, the VPC must have an Internet gateway attached. For more information, see Connecting Instances in a VPC to the Internet.
You can disassociate and reassociate an EIP at any time. This enables you, in case of instance failure, to transfer the EIP to another instance. Therefore, the new instance has the same public IP address, which means that scripts or applications using this EIP do not encounter any issue. For more information, see the EIP Association section below.
In the public Cloud, the EIP replaces the public IP of the instance. In a VPC, the EIP attaches a public IP address to the instance or to the primary network interface. If you are working with several network interfaces, you can choose to associate the EIP with the primary network interface or with a flexible network interface (FNI). In that case, you can also choose to associate the EIP with either the primary private IP address of the network interface or one of its secondary private IP addresses. For more information, see About FNIs.
You can associate an EIP with only one instance or network interface at a time.
Using Cockpit, you always need to disassociate the EIP before you can reassociate it with another resource. Using the API, you can specify the reassociation behavior: either prevent it, or automatically disassociate the EIP and reassociate it with the new instance or network interface. For more information, see Associating an EIP with an Instance or a Network Interface.
You can also associate an EIP with a NAT gateway. However, you can do so only when creating the NAT gateway. To modify the EIP associated with a NAT gateway, you need to delete the NAT gateway and re-create it with the new EIP. For more information, see Creating a NAT Gateway.
You can associate an EIP using one of the following solutions:
- For a non-persistent association, the
This method instantly associates the EIP with a running instance. However, the EIP is disassociated from the instance every time you stop and start it. For more information, see Associating an EIP with an Instance or a Network Interface.
For a persistent association, the
This tag enables you to associate an EIP with an instance and fix it to the instance through the stop and start process. It is taken into account only at boot, that is, after launch and after a stop start. You can add this tag using regular tags or in the user data of the instance, with
osc.fcu.eip.auto-attachas Key and the EIP as Value. For more information, see Tagging Your Resources or Configuring an Instance with User Data and OUTSCALE Tags.
- If you do not have time to stop and start your instance to associate the EIP with the instance using the
osc.fcu.eip.auto-attachtag, you can associate it using the
AssociateAddressmethod, and then add this tag to the instance using the same EIP as value. Therefore, the EIP will be fixed to the instance the next time you stop and start it.
- If you add the
osc.fcu.eip.auto-attachtag to an instance that already has an EIP associated or replace its value with another EIP, the current EIP will be removed and replaced with the new EIP you specify as value the next time you stop and start the instance.
- As network interfaces do not follow a stop and start lifecycle, the association between an EIP and a network interface is always persistent.
After you disassociate an EIP, it is still allocated to your account. If you do not use an allocated EIP anymore, you can release it to make it available for other users. For more information, see Disassociating an EIP from an Instance or a Network Interface and Releasing an EIP from Your Account.
Ensure that none of your applications or scripts use the EIP you release.