Updated on 2023-03-17 GMT+08:00

Binding an EIP

Function

This API is used to bind an EIP.

URI

POST /v3/{project_id}/eip/publicips/{publicip_id}/associate-instance

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Minimum length: 0

Maximum length: 32

publicip_id

Yes

String

EIP ID.

Minimum length: 0

Maximum length: 36

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used for obtaining a user token. The value of X-Subject-Token in the response header is the user token.

Minimum length: 0

Maximum length: 4096

Table 3 Request body parameter

Parameter

Mandatory

Type

Description

publicip

Yes

AssociatePublicipsOption object

EIP object.

Table 4 AssociatePublicipsOption

Parameter

Mandatory

Type

Description

associate_instance_type

Yes

String

  • Type of the instance that the port belongs to.
  • The value can be PORT, NATGW, VPN, or ELB.
  • Constraints:
    • If neither associate_instance_type nor associate_instance_id is left empty, the instance is bound.
    • associate_instance_type cannot be empty.
    • A dual-stack EIP cannot have its bound instance changed.

Minimum length: 0

Maximum length: 36

Enumerated values:

  • PORT
  • NATGW
  • VPN
  • ELB

associate_instance_id

Yes

String

  • ID of the instance that the port belongs to, for example, RDS instance ID.
  • Constraints:
    • If neither associate_instance_type nor associate_instance_id is left empty, the instance is bound.
    • associate_instance_id cannot be empty.
    • A dual-stack EIP cannot have its bound instance changed.

Minimum length: 0

Maximum length: 36

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Request ID.

Minimum length: 0

Maximum length: 36

publicip

PublicipInstanceResp object

Response body of binding an EIP.

Table 6 PublicipInstanceResp

Parameter

Type

Description

id

String

  • Unique ID of the EIP.

Minimum length: 0

Maximum length: 36

project_id

String

  • Project ID.

Minimum length: 0

Maximum length: 32

ip_version

Integer

  • IP address version.
  • The value can be:
    • 4: IPv4 EIP
    • 6: IPv6 EIP

Enumerated values:

  • 4
  • 6

public_ip_address

String

  • EIP or IPv6 port address.

Minimum length: 0

Maximum length: 36

status

String

  • EIP status.
  • The value can be:
    • FREEZED (Frozen)
    • BIND_ERROR (Binding failed)
    • BINDING (Binding)
    • PENDING_DELETE (Releasing)
    • PENDING_CREATE (Assigning)
    • NOTIFYING
    • NOTIFY_DELETE
    • PENDING_UPDATE (Updating)
    • DOWN (Unbound)
    • ACTIVE (Bound)
    • ELB (Bound to a load balancer)
    • VPN (Bound to a VPN)
    • ERROR

Enumerated values:

  • FREEZED
  • BIND_ERROR
  • BINDING
  • PENDING_DELETE
  • PENDING_CREATE
  • NOTIFYING
  • NOTIFY_DELETE
  • PENDING_UPDATE
  • DOWN
  • ACTIVE
  • ELB
  • ERROR
  • VPN

description

String

  • Supplementary information about the EIP.
  • This is customized by users and is not perceived by the system.

Minimum length: 1

Maximum length: 255

public_border_group

String

  • Whether the resource is in a central region or an edge site.
  • The value can be center or an edge site name.
  • This resource can only be associated with an EIP of the same region.

Minimum length: 1

Maximum length: 64

created_at

String

  • Time (UTC) when an EIP is assigned.
  • Format: yyyy-MM-ddTHH:mm:ssZ

updated_at

String

  • Time (UTC) when an EIP is updated.
  • Format: yyyy-MM-ddTHH:mm:ssZ

type

String

  • EIP type

Minimum length: 1

Maximum length: 36

Enumerated values:

  • EIP
  • DUALSTACK
  • DUALSTACK_SUBNET

vnic

VnicInfo object

  • Port information of the instance with an EIP bound.
  • If the instance with an EIP bound does not depend on a port, the value is null.

bandwidth

PublicipBandwidthInfo object

  • Bandwidth bound to an EIP.

enterprise_project_id

String

  • Enterprise project ID. The value is 0 or a string that contains a maximum of 36 characters in UUID format with hyphens (-). This is the ID of the enterprise project that you associate with the EIP when you assign the EIP.

Minimum length: 0

Maximum length: 36

billing_info

String

  • Order information of an EIP.
  • Order information is available only for yearly/monthly resources. This parameter is left empty for pay-per-use resources.

Minimum length: 0

Maximum length: 256

lock_status

String

  • Frozen status of an EIP.
  • The metadata type indicates that the EIP is frozen due to arrears or security reasons.
  • Value range: police or locked

Minimum length: 0

Maximum length: 64

associate_instance_type

String

  • Type of the instance bound with an EIP.
  • Value range: PORT, NATGW, ELB, ELBV1, VPN or null

Minimum length: 0

Maximum length: 64

Enumerated values:

  • PORT
  • NATGW
  • ELB
  • ELBV1
  • VPN
  • null

associate_instance_id

String

  • ID of the instance bound with an EIP.

Minimum length: 0

Maximum length: 64

publicip_pool_id

String

  • ID of the network that an EIP belongs to. Network ID corresponding to publicip_pool_name

Minimum length: 0

Maximum length: 36

publicip_pool_name

String

  • Network type of an EIP, including public EIP pool (for example, 5_bgp or 5_sbgp) and dedicated EIP pool.
  • For details about the dedicated EIP pool, see the APIs about publcip_pool.

Minimum length: 0

Maximum length: 64

alias

String

  • EIP name.

Minimum length: 0

Maximum length: 64

Table 7 VnicInfo

Parameter

Type

Description

private_ip_address

String

  • Private IP address.

Minimum length: 0

Maximum length: 36

device_id

String

  • ID of the device that a port belongs to.
  • The system automatically sets this parameter.

Minimum length: 0

Maximum length: 36

device_owner

String

  • Device that the port belongs to.
  • The value can be:
    • network:dhcp
    • network:VIP_PORT
    • network:router_interface_distributed
    • network:router_centralized_snat
  • The system automatically sets this parameter.

Minimum length: 0

Maximum length: 64

vpc_id

String

  • VPC ID.

Minimum length: 0

Maximum length: 36

port_id

String

  • Port ID.

Minimum length: 0

Maximum length: 36

port_profile

String

  • Port profile.

Minimum length: 0

Maximum length: 256

mac

String

  • Port MAC address.
  • The system automatically sets this parameter.

Minimum length: 0

Maximum length: 64

vtep

String

  • VTEP IP address.

Minimum length: 0

Maximum length: 36

vni

String

  • VXLAN ID.

Minimum length: 0

Maximum length: 36

instance_id

String

  • ID of the instance that the port belongs to, for example, RDS instance ID.
  • The system automatically sets this parameter.

Minimum length: 0

Maximum length: 36

instance_type

String

  • Type of the instance that the port belongs to, for example, RDS.
  • The system automatically sets this parameter.

Minimum length: 0

Maximum length: 36

Table 8 PublicipBandwidthInfo

Parameter

Type

Description

id

String

  • Bandwidth ID.

Minimum length: 0

Maximum length: 36

size

Integer

  • Bandwidth size.
  • The value ranges from 5 Mbit/s to 2000 Mbit/s by default.

Minimum value: 0

Maximum value: 99999

share_type

String

  • Whether the bandwidth is shared or dedicated.
  • The value can be:
    • PER: Dedicated bandwidth
    • WHOLE: Shared bandwidth
  • IPv6 addresses do not support bandwidth whose type is WHOLE.

Minimum length: 0

Maximum length: 36

charge_mode

String

  • Whether the billing is based on traffic or bandwidth.
  • The value can be:
    • bandwidth: billed by bandwidth
    • traffic: billed by traffic
    • 95peak_plus: billed by 95th percentile bandwidth (enhanced)

Minimum length: 0

Maximum length: 36

name

String

  • Bandwidth name.
  • The value can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).

Minimum length: 0

Maximum length: 64

billing_info

String

  • Billing information. If billing_info is specified, the bandwidth is billed on a yearly/monthly basis.

Minimum length: 0

Maximum length: 256

Example Request

{
  "publicip" : {
    "associate_instance_id" : "921b9dc7-8151-41e1-b83c-d50fe959592a",
    "associate_instance_type" : "PORT"
  }
}

Example Response

Status code: 200

Normal response to POST requests

Status Codes

See Status Codes.

Error Codes

See Error Codes.