Assigning an EIP

Function

Assign an EIP.

URI

POST /v3/{project_id}/eip/publicips

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

  • Definition: Project ID.

  • Range: None

Maximum: 32

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

publicip

Yes

EIPAddDict object

Request body for assigning an EIP

Table 3 EIPAddDict

Parameter

Mandatory

Type

Description

id

No

String

  • Definition: EIP ID.

  • Constraints: The value is in the UUID format and can be specified only by the administrator.

Minimum: 36

Maximum: 36

ip_version

No

Integer

  • Definition: IP address version.

  • Constraints: The configured value must be supported by the system.

  • Range:

    • 4: IPv4 EIP

    • 6: IPv6 EIP

Minimum: 4

Maximum: 6

alias

No

String

Definition: EIP name

Minimum: 0

Maximum: 255

type

No

String

  • Definition: EIP type.

  • Constraints: N/A

  • Range:

    • EIP: IPv4 EIP.

    • DUALSTACK: IPv6 EIP.

  • Default Value: N/A

publicip_pool_name

Yes

String

  • Definition: Network type of an EIP, including public EIP pool (for example, 5_bgp or 5_sbgp) and dedicated EIP pool.

  • For details about a dedicated EIP pool, see the APIs about publicip_pool.

public_ip_address

No

String

  • Definition: EIP to be assigned. The system automatically assigns an EIP if you do not specify it.

  • Constraints: The value must be a valid IPv4 address in the available IP address range.

Minimum: 0

Maximum: 64

public_ipv6_address

No

String

  • Definition: Obtained EIP if IPv6 EIPs are available. This parameter does not exist if only IPv4 EIPs are available.

description

No

String

  • Definition: EIP description.

  • Constraints: You can customize this value to identify your EIP, which is not perceived by the system.

enterprise_project_id

No

String

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

bandwidth

Yes

PublicipBandwidthInfo object

Bandwidth bound to an EIP

associate_instance_type

No

String

  • Definition: Type of the instance that the EIP is bound to. It can be filtered by associate_instance_type.

  • Range:

    • PORT (Instance type, including ECS, BMS, and CCE)

    • NATGW (NAT gateway type)

    • ELB (Load balancer type)

    • ELBV1 (ELBv1 instance type, classic ELBv1)

    • VPN (VPN instance type)

associate_instance_id

No

String

  • Definition: ID of the bound instance

  • Constraints: If neither associate_instance_type nor associate_instance_id is empty, an instance is bound. If both associate_instance_type and associate_instance_id are null, an instance is unbound.

Minimum: 0

Maximum: 36

billing_info

No

String

Definition: Order information.

Minimum: 0

Maximum: 1024

cascade_delete_by_instance

No

Boolean

This parameter is supported when the ECS is called. If the value is true, the EIP is released when the ECS is deleted. If the value is false, the EIP is not released when the ECS is deleted.

Default: false

associate_mode

No

String

  • Definition: Passthrough mode. This parameter is available after the passthrough mode is enabled. (Not displayed by default)

Minimum: 1

Maximum: 36

lock_infos

No

Array of strings

Frozen status of an EIP.

Table 4 PublicipBandwidthInfo

Parameter

Mandatory

Type

Description

id

No

String

  • Definition: Bandwidth ID

size

Yes

Integer

  • Definition: Bandwidth size.

  • Range: The value ranges from 5 Mbit/s to 2000 Mbit/s by default.

share_type

Yes

String

  • Definition: Whether the bandwidth is shared or dedicated.

  • Range:

    • PER: dedicated bandwidths

    • WHOLE: shared bandwidth

    [- Constraints: IPv6 addresses do not support bandwidth whose type is "WHOLE".] (tag:hws,srg)

charge_mode

No

String

  • Definition: Whether the billing is based on traffic or bandwidth.

  • Range:

    • bandwidth: billed by bandwidth

    • traffic: billed by traffic

    • 95peak_plus: 95th percentile bandwidth (enhanced)

name

Yes

String

  • Definition: Bandwidth name.

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

billing_info

No

String

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

Response Parameters

Status code: 201

Table 5 Response body parameters

Parameter

Type

Description

publicip

PublicipResp object

EIP

request_id

String

Request ID.

Table 6 PublicipResp

Parameter

Type

Description

id

String

  • Definition: EIP ID, which uniquely identifies the EIP.

project_id

String

  • Definition: Project ID.

ip_version

Integer

  • Definition: EIP version.

  • Range: The value can be 4 or 6. 6 indicates that the NAT64 capability is enabled.

    • 4: IPv4 EIP

    • 6: IPv6 EIP

public_ip_address

String

  • Definition: IPv4 EIP.

public_ipv6_address

String

  • Definition: IPv6 EIP.

status

String

  • Definition: EIP status

  • Range: The value can be FREEZED, DOWN, ACTIVE, or ERROR.

    • FREEZED: The EIP is frozen.

    • DOWN: The EIP is not bound to any instance.

    • ACTIVE: The EIP is bound to an instance and is in use.

    • ERROR: The EIP status is abnormal.

description

String

  • Definition: Supplementary information about the EIP.

  • Constraints: You can customize this value to identify your EIP, which is not perceived by the system.

created_at

String

  • Definition: Time when an EIP was assigned.

  • Constraints: The value is in UTC format, for example, 2018-12-25T10:07:24Z.

updated_at

String

  • Definition: Time when an EIP is updated.

  • Constraints: The value is in UTC format, for example, 2018-12-25T10:09:20Z.

type

String

  • Definition: EIP type.

  • Constraints: N/A

  • Range:

    • EIP: IPv4 EIP.

    • DUALSTACK: IPv6 EIP.

  • Default Value: N/A

vnic

VnicResp object

  • Definition: Port information of the instance that an EIP is bound to.

  • Constraints: If the instance has no port, the value is null.

bandwidth

BandwidthResp object

  • Definition: Bandwidth of the EIP.

enterprise_project_id

String

  • Definition: Enterprise project ID of the EIP.

billing_info

String

  • Definition: Order information of an EIP.

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

lock_status

String

  • Definition: Frozen reason of the EIP.

  • Constraints: The metadata type is used.

  • Range:

    • POLICE: frozen due to public security issues

    • LOCKED: frozen due to common issues

    • ARREAR: frozen due to arrears

    • DELABLE: frozen and can be deleted

  • Default Value: N/A

associate_instance_type

String

  • Definition: Type of the instance with an EIP bound.

  • Range:

    • PORT (Instance type, including ECS, BMS, and CCE)

    • NATGW (NAT gateway type)

    • ELB (Load balancer type)

    • VPN (VPN instance type)

associate_instance_id

String

  • Definition: ID of the instance with an EIP bound.

publicip_pool_id

String

  • Definition: ID of the network that an EIP belongs to. It is the network ID corresponding to publicip_pool_name.

publicip_pool_name

String

  • Definition: Network type of an EIP,

including public EIP pool (for example, 5_bgp or 5_sbgp) and dedicated EIP pool. For details about a dedicated EIP pool, see the APIs about publicip_pool.

alias

String

  • Definition: EIP alias.

public_border_group

String

  • Definition: Whether it is a central or an edge resource. The value is CENTER for a central EIP and an edge AZ name for an edge EIP.

Table 7 VnicResp

Parameter

Type

Description

private_ip_address

String

  • Definition: Private IP address of a port.

device_id

String

  • Definition: ID of the device that the port belongs to. The device ID indicates the ID of the cloud service resource that uses the private IP address in the subnet, for example, the cloud server ID or load balancer ID.

  • Constraints: If there is a port, the value of this parameter is the same as that of associate_instance_id, which is the instance ID.

device_owner

String

  • Definition: Device that the port belongs to, that is, a cloud service resource that uses a private IP address in the subnet.

  • Constraints: If there is a port, both this parameter and associate_instance_type can be used to identify the instance type.

vtep

String

  • Definition: VTEP IP address.

vni

String

  • Definition: VXLAN ID.

vpc_id

String

  • Definition: ID of the VPC that the port belongs to.

port_id

String

  • Definition: Port ID, which uniquely identifies a port.

port_profile

String

  • Definition: Port profile.

mac

String

  • Definition: MAC address of a port.

instance_id

String

  • Definition: Port user, which is different from the owner of device_id. For example, the device_owner of a virtual IP address port is a virtual IP address, but the actual user of the port may be a VM or others.

instance_type

String

  • Definition: Port user.

  • Constraints: N/A

  • Range:

    • PORT: elastic network interface

    • PEP_PORT: PEP elastic network interface

    • EVPN: Ethernet virtual private network

    • NATGW: NAT gateway

    • P2CVPN: P2C virtual private network

  • Default Value: N/A

port_vif_details

String

  • Definition: Details about the virtual interface of the network interface

Table 8 BandwidthResp

Parameter

Type

Description

id

String

  • Definition: Bandwidth ID.

size

Integer

  • Definition: Bandwidth size.

share_type

String

  • Definition: Type.

WHOLE indicates a shared bandwidth, and PER indicates a dedicated bandwidth.

charge_mode

String

  • Definition: Bandwidth billing mode.

name

String

  • Definition: Bandwidth name.

billing_info

String

  • Definition: Bandwidth order information.

Example Requests

Assign an IPv4 EIP with dedicated bandwidth.

POST https://{Endpoint}/v3/{project_id}/eip/publicips

{
  "publicip" : {
    "type" : "EIP",
    "publicip_pool_name" : "5_telcom",
    "bandwidth" : {
      "size" : 300,
      "share_type" : "PER",
      "charge_mode" : "bandwidth",
      "name" : "bandwidth-b556"
    }
  }
}

Example Responses

Status code: 201

Normal creation

{
  "publicip" : {
    "id" : "0c464dad-86f3-4953-8bd4-c22bb0eb0bde",
    "project_id" : "b2782e6708b8475c993e6064bc456bf8",
    "alias" : "test eip",
    "ip_version" : 4,
    "public_ip_address" : "100.64.0.253",
    "publicip_pool_name" : "5_telcom",
    "status" : "ACTIVE",
    "description" : "description test",
    "created_at" : "2018-12-25T10:07:24Z",
    "updated_at" : "2018-12-25T10:07:24Z",
    "type" : "EIP",
    "vnic" : {
      "private_ip_address" : "172.16.1.75",
      "device_id" : "b61769a5-f8c4-448f-ae5b-2cbe1baa20ca",
      "device_owner" : "compute:AZ1",
      "vpc_id" : "1314cd0b-5dea-4697-b45a-a2304ff87e9c",
      "port_id" : "b01795fc-a246-4e4c-b770-0e4d58101592",
      "mac" : "fa:16:3e:ac:a8:0b"
    },
    "bandwidth" : {
      "id" : "b01795fc-a246-4e4c-b770-0e4d58101592",
      "size" : 300,
      "share_type" : "PER",
      "charge_mode" : "traffic",
      "name" : "bandwidth-b556"
    },
    "enterprise_project_id" : "b261ac1f-2489-4bc7-b31b-c33c3346a439",
    "associate_instance_type" : "PORT",
    "associate_instance_id" : "b61769a5-f8c4-448f-ae5b-2cbe1baa20ca",
    "public_border_group" : "CENTER"
  },
  "request_id" : "4a06c169-cc67-4d94-a786-2d70ef09b100"
}

Status Codes

Status Code

Description

201

Normal creation

Error Codes

See Error Codes.