:original_name: AssociatePublicips.html .. _AssociatePublicips: Binding an EIP ============== Function -------- This API is used to bind an EIP. (This API is not supported in **eu-nl**.) URI --- POST /v3/{project_id}/eip/publicips/{publicip_id}/associate-instance .. table:: **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:: **Table 2** Request body parameter +-----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+ | Parameter | Mandatory | Type | Description | +===========+===========+=========================================================================================================================================================+=============+ | publicip | Yes | :ref:`AssociatePublicipsOption ` object | EIP object. | +-----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+ .. _associatepublicips__en-us_topic_0000001543103905_en-us_topic_0000001403541982_request_associatepublicipsoption: .. table:: **Table 3** 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:: **Table 4** Response body parameters +-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+ | Parameter | Type | Description | +=======================+==================================================================================================================================================+==================================+ | request_id | String | Request ID. | | | | | | | | Minimum length: **0** | | | | | | | | Maximum length: **36** | +-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+ | publicip | :ref:`PublicipInstanceResp ` object | Response body of binding an EIP. | +-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+ .. _associatepublicips__en-us_topic_0000001543103905_en-us_topic_0000001403541982_response_publicipinstanceresp: .. table:: **Table 5** 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, which is not supported currently. | | | | | | | | 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** | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | vnic | :ref:`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 | :ref:`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. | | | | - 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 abuse. | | | | - 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** | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. _associatepublicips__en-us_topic_0000001543103905_en-us_topic_0000001403541982_response_vnicinfo: .. table:: **Table 6** 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** | +-----------------------+-----------------------+-------------------------------------------------------------------------------+ .. _associatepublicips__en-us_topic_0000001543103905_en-us_topic_0000001403541982_response_publicipbandwidthinfo: .. table:: **Table 7** PublicipBandwidthInfo +-----------------------+-----------------------+------------------------------------------------------------------------------------------------------------------------+ | Parameter | Type | Description | +=======================+=======================+========================================================================================================================+ | id | String | - Bandwidth ID. | | | | | | | | Minimum length: **0** | | | | | | | | Maximum length: **36** | +-----------------------+-----------------------+------------------------------------------------------------------------------------------------------------------------+ | size | Integer | - Bandwidth size. | | | | | | | | - The value ranges from 1 Mbit/s to 1000 Mbit/s by default. | | | | | | | | Minimum value: **1** | | | | | | | | Maximum value: **1000** | +-----------------------+-----------------------+------------------------------------------------------------------------------------------------------------------------+ | 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. | | | | | | | | Minimum length: **0** | | | | | | | | Maximum length: **256** | +-----------------------+-----------------------+------------------------------------------------------------------------------------------------------------------------+ Example Request --------------- .. code-block:: { "publicip" : { "associate_instance_id" : "921b9dc7-8151-41e1-b83c-d50fe959592a", "associate_instance_type" : "PORT" } } Example Response ---------------- **Status code: 200** Normal response to POST requests .. code-block:: { "publicip" : { "alias" : "abcd", "associate_instance_id" : "921b9dc7-8151-41e1-b83c-d50fe959592a", "associate_instance_type" : "PORT", "bandwidth" : { "billing_info" : "xxxx:xxxx:xxxx:xxxx", "charge_mode" : "bandwidth", "id" : "80549ae1-cf7a-4f39-a45f-bdb8e194a1f4", "name" : "bandwidth-bd25-test", "share_type" : "WHOLE", "size" : 7 }, "billing_info" : null, "created_at" : "2020-06-18T14:05:32Z", "description" : "test!!!!", "enterprise_project_id" : "0", "public_border_group" : "center", "id" : "b0c42aa6-3d1d-4b39-9188-35ee6aa8d6f7", "ip_version" : 4, "lock_status" : null, "project_id" : "060576782980d5762f9ec014dd2f1148", "public_ip_address" : "xx.xx.xx.xx", "publicip_pool_id" : "160576782980d5762f9ec014dd2f1148", "publicip_pool_name" : "5_mobile", "status" : "ACTIVE", "type" : "EIP", "updated_at" : "2020-06-18T14:05:32Z", "vnic" : { "device_id" : "78aa6d7f-7111-434e-9a93-0dc6fdacff63", "device_owner" : "network:nat_gateway", "instance_id" : "", "instance_type" : "", "mac" : "fa:16:3e:83:6b:0a", "port_id" : "921b9dc7-8151-41e1-b83c-d50fe959592a", "port_profile" : null, "private_ip_address" : "xx.xx.xx.xx", "vni" : null, "vpc_id" : "a26c231a-cf6f-48d3-83db-1e261d0e235a", "vtep" : null } }, "request_id" : "ead9f912bd1191e3d5f0037141098d91" } Status Codes ------------ See :ref:`Status Codes `. Error Codes ----------- See :ref:`Error Codes `.