AssociateAddress

GET /?Action=AssociateAddress
Description

Associates an External IP address (EIP) with an instance or a network interface, in the public Cloud or in a Virtual Private Cloud (VPC). You can associate an EIP with only one instance or network interface at a time.
To associate an EIP in a VPC, ensure that the VPC has an Internet gateway attached. For more information, see the AttachInternetGateway method.
By default, the EIP is disassociated every time you stop and start the instance. For a persistent association, you can add the osc.fcu.eip.auto-attach tag to the instance with the EIP as value. For more information, see the CreateTags method.

Note

You can associate an EIP with a NAT gateway only when creating the NAT gateway. To modify its EIP, you need to delete the NAT gateway and re-create it with the new EIP. For more information, see the CreateNatGateway method.

Body parameter

Required: false
Name: AssociateAddressRequest

Name Description Required Schema Default Example

AllocationId

The allocation ID of the EIP. In a VPC, this parameter is required.

false

string

AllowReassociation

If set to true, allows the EIP to be associated with the instance or network interface that you specify even if it is already associated with another instance or network interface. If set to false, prevents the EIP from being associated with the instance or network interface that you specify if it is already associated with another instance or network interface. (By default, true in the public Cloud, false in a VPC.)

false

boolean

InstanceId

The ID of the instance.

- In the public Cloud, this parameter is required.
- In a VPC, this parameter is required if the instance has only one network interface. Otherwise, you need to specify the NetworkInterfaceId parameter instead. You cannot specify both parameters at the same time.

false

string

NetworkInterfaceId

(VPC only) The ID of the network interface.
This parameter is required if the instance has more than one network interface attached. Otherwise, you need to specify the InstanceId parameter instead. You cannot specify both parameters at the same time.

false

string

PrivateIpAddress

(VPC only) The primary or secondary private IP address of the specified network interface. By default, the primary private IP address.

false

string

PublicIp

The External IP address. In the public Cloud, this parameter is required.

false

string

Responses
HTTP Code 200
HTTP Code Description Schema

200

AssociateAddressResult

Response 200

Response 200

Name Description Required Schema Default Example

associationId

(VPC only) The ID that represents the association of the EIP with the instance or the network interface.

false

string

requestId

The ID of the request.

false

string