Bind EIP
- Can be used to bind an EIP to any BLB or BCC instance.
- Binding is only supported for available EIPs.
- The instance to be bound must not have any existing EIP bindings.
- The instance to be bound cannot be in debt.
Request structure
1PUT /v{version}/eip/{eip}?{action}&clientToken={clientToken} HTTP/1.1
2Host: eip.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "instanceType": instanceType,
7 "instanceId": instanceId,
8 "instanceIp": instanceIp
9}
Request headers
No special headers beyond common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number, current value is 1. |
| eip | String | Yes | URL parameter | Supports binding both IPv4 and IPv6 EIPs. |
| action | String | Yes | Query | Action executed on the EIP instance. In this API, the value of this parameter is bind |
| clientToken | String | Yes | Query | Idempotence token; for details, refer to [Idempotence](EIP/API Reference/General Description.md#Idempotence) |
| instanceType | [instanceType](EIP/API Reference/Appendix 1.md#instanceType) | Yes | RequestBody | Bound instance type |
| instanceId | String | Yes | RequestBody | Bound instance ID |
| instanceIp | String | No | RequestBody | IP in the instance required to be bound with an EIP |
When an EIP is bound to an elastic network interface or BCC, it defaults to binding with the primary IP address of the elastic network interface or the primary IP address of the primary network interface card in the BCC. To bind with a secondary IP address of the elastic network interface or a secondary IP address of the primary network interface card in the BCC, the specific IP to be bound may be assigned in the instanceIp parameter
Response Status Code
Respond with 200 after successful operation, and respond with error codes after failed operation, as shown in [Error Codes](EIP/API Reference/Error code.md).
Response headers
No additional headers beyond standard ones.
Response parameters
No special response parameters are available.
Request example
Example request: Bind EIP to a BCC instance.
1PUT /v1/eip/180.76.122.3?bind&clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
2HOST eip.bj.baidubce.com
3Authorization bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2016-04-10T08:26:52Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02
4
5{
6 "instanceType": "BCC",
7 "instanceId": "i-Tkjq337f"
8}
Example request: Bind EIP to an elastic network interface.
1PUT /v1/eip/120.48.186.48?bind&clientToken=31d167e1-2dbd-40bf-853b-d692ac134c75 HTTP/1.1
2HOST eip.bj.baidubce.com
3Authorization bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2024-06-21T10:17:45Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02
4
5{
6 "instanceType": "ENI",
7 "instanceId": "eni-hjxg7hw1zdri"
8}
Example request: Bind EIP to a BLB instance.
1PUT /v1/eip/180.76.122.3?bind&clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
2HOST eip.bj.baidubce.com
3Authorization bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2016-06-21T08:26:52Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02
4
5{
6 "instanceType": "BLB",
7 "instanceId": "lb-3ytqlktb"
8}
Example request: Bind EIP to the secondary IP address of an elastic network interface.
1PUT /v1/eip/120.48.186.48?bind&clientToken=fb21f917-33c2-4f33-96c3-674d965a0032 HTTP/1.1
2HOST eip.bj.baidubce.com
3Authorization bce-auth-v1/5e5a8adf11ae475ba95f1bd38228b44f/2024-06-21T10:24:08Z/1800/host;x-bce-date/ec3c0069f9abb1e247773a62707224124b2b31b4c171133677f9042969791f02
4
5{
6 "instanceType": "ENI",
7 "instanceId": "eni-hjxg7hw1zdri",
8 "instanceIp": "192.168.0.3"
9}
Example request: Bind an IPv6 EIP to the secondary IP address of a BCC primary network interface card.
1PUT /v1/eip/2400:da00:e003:2078:0:3:0:1ed?bind&clientToken=a7e580a2-79d7-4203-9c31-a68a1cf7d108 HTTP/1.1
2HOST eip.bj.baidubce.com
3Authorization bce-auth-v1/08e28f03ea9b11eea8a715135d6be69f/2024-03-25T12:31:26Z/3600/host;x-bce-date/d04aa904d61c452565af7471510f1f1d03f0d7ede2a1bb55eff60b5c6d94211a
4
5{
6 "instanceType": "BCC",
7 "instanceId": "i-1GPwA4Iy",
8 "instanceIp": "2400:da00:e003:0:27c:c00:0:5"
9}
Response example
1HTTP/1.1 200 OK
2x-bce-request-id: 946002ee-cb4f-4aad-b686-5be55df27f09
3Date: Wed, 10 Apr 2016 08:26:52 GMT
4Transfer-Encoding: chunked
5Content-Type: application/json;charset=UTF-8
6Server: BWS
