EIP Instance
Create EIP
- Apply for an EIP, which can be bound to any BCC or BLB instances.
- Certification is required for creating EIP. Those who have not passed certification can go to the certification under security certification in the Baidu Open Cloud Official Website Console for certification.
Function declaration
1def create_eip(self, bandwidth_in_mbps, name=None, billing=None,
2 client_token=None, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Wjwvz30fv
Response Value
Operation succeeded:
1{
2 "eip":"180.181.3.133"
3}
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_create_eip.py
EIP bandwidth scaling
- Used for scaling the bandwidth of a specified EIP
- Check the EIP scaling status by querying the EIP list
Function declaration
1def resize_eip(self, eip, new_bandwidth_in_mbps, client_token=None,
2 config=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Hjwvz325u
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_resize_eip.py
Bind EIP
- Bind EIP to an instance, such as BCC, BLB, and BBC
- Binding is supported only for available EIP
- The bound instance must not have any existing EIP binding relationships
- The bound instance cannot be in debt status
Function declaration
1def bind_eip(self, eip, instance_type, instance_id, client_token=None,
2 config=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/9jwvz31gn
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, refer to example_bind_eip.py
Unbind EIP
- Unbind a specified EIP
- The unbound EIP must have been bound to any instance
Function declaration
1def unbind_eip(self, eip, client_token=None, config=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Djwvz314s
Response Value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, refer to example_unbind_eip.py
Release EIP
- The release of a specified EIP cannot be recovered once it is released
- If an EIP is bound to any instance, it must be unbound before release
Function declaration
1def release_eip(self, eip, client_token=None, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Rjwvz32ig
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_release_eip.py
Query EIP list
- The EIP list can be filtered using various criteria.
- To view details of a specific EIP, only the eip parameter is needed.
- To see EIPs linked to a particular instance type, only the instanceType parameter is required.
- To view details of EIPs tied to a specific instance, you need to provide both the instanceType and instanceId parameters.
- If no specific criteria are specified, all EIPs will be listed by default.
- The returned results are based on the overlap of multiple conditions, meaning that if multiple conditions are set, the query will return only the EIPs that meet all conditions.
- The query results support marker-based pagination, with a default page size of 1,000. You can adjust this by setting the maxKeys parameter.
Function declaration
1def list_eips(self, eip=None, instance_type=None, instance_id=None, status=None,
2 marker=None, max_keys=1000, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Pjwvz30qy
Response value
Operation succeeded:
1{
2 "eipList": [
3 {
4 "name":"eip-xxxxxxx-1",
5 "eip": "x.x.x.x",
6 "status":"binded",
7 "instanceType": "BCC",
8 "instanceId": "i-xxxxxxx",
9 "bandwidthInMbps": 5,
10 "paymentTiming":"Prepaid",
11 "billingMethod":"ByBandwidth",
12 "createTime":"2023-10-08T08:13:09Z",
13 "expireTime":"2023-12-08T08:13:09Z"
14 },
15 {
16 "name":"eip-xxxxxxx-1",
17 "eip": "x.x.x.x",
18 "status":"binded",
19 "instanceType": "BCC",
20 "instanceId": "i-xxxxxxx",
21 "bandwidthInMbps": 1,
22 "paymentTiming":"Postpaid",
23 "billingMethod":"ByTraffic",
24 "createTime":"2023-09-08T08:13:09Z",
25 "expireTime":null
26 },
27 ],
28 "marker":"eip-xxxxxxx-1",
29 "isTruncated": true,
30 "nextMarker": "eip-DCB50387",
31 "maxKeys": 2
32}
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_list_eips.py
Renew EIP
- Renewal operation for specified EIP; extend the expiration period.
- EIP scaling prevents renewal operations from being executed.
Function declaration
1def purchase_reserved_eip(self, eip, billing=None, client_token=None,
2 config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Yjwvz31ty
Response Value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_purchase_reserved_eip.py
EIP auto-renewal has been enabled
- The EIP charge type is prepay
- The EIP is not been assigned with shift charge tasks
- The EIP has not been enabled with auto-renewal function
Function declaration
1def start_auto_renew_eip(self, eip, auto_renew_time_unit=None, auto_renew_time=None,
2 client_token=None, config=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Sk9gykbek
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_start_auto_renew.py
Disable EIP auto-renewal
- Require EIP to have enabled auto-renewal
Function declaration
1def stop_auto_renew_eip(self, eip, client_token=None, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Sk9gykbek
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_stop_auto_renew.py
Enable EIP direct
- The EIP must have been bound to a BCC, DCC, ENI or BLB instance.
1def direct_eip(self, eip, client_token=None, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/aknohnbq1
Response Value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_direct_eip.py
Disable EIP direct
- The EIP direct must have been enabled
1def undirect_eip(self, eip, client_token=None, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Pknohwcdb
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_undirect_eip.py
Query EIP list in bucket trash
- Retrieve details about EIP within the bucket trash of the user account.
- Allow queries by EIP address or name, supporting fuzzy search for both methods.
- If no specific criteria are specified, all EIPs will be listed by default.
- The results returned reflect the intersection of multiple conditions, meaning EIPs meeting all provided criteria are shown.
- Results support marker-based pagination, with a default page size of 1,000, adjustable via the maxKeys parameter.
Function declaration
1def list_eip_recycle(self, eip=None, name=None, marker=None, max_keys=1000, config=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/dl0anm1j8
Response value
Operation succeeded:
1{
2 "eipList": [
3 {
4 "name":"eip-xxxxxxx-1",
5 "eip": "x.x.x.x",
6 "eip_id":"ip-xxxxxxxx",
7 "status": "paused",
8 "route_type": "BGP",
9 "bandwidth_in_mbps": 5,
10 "payment_timing":"Prepaid",
11 "billing_method":"ByBandwidth",
12 "recycle_time":"2023-07-08T08:13:09Z",
13 "scheduled_delete_time":"2023-08-08T08:13:09Z"
14 },
15 {
16 "name":"eip-xxxxxxx-2",
17 "eip": "x.x.x.x",
18 "eip_id":"ip-xxxxxxxx",
19 "status": "paused",
20 "route_type": "BGP",
21 "bandwidth_in_mbps": 10,
22 "payment_timing":"Postpaid",
23 "billing_method":"ByBandwidth",
24 "recycle_time":"2023-06-08T08:13:09Z",
25 "scheduled_delete_time":"2023-07-08T08:13:09Z"
26 },
27 ],
28 "marker":"ip-xxxxxxxx",
29 "is_truncated": true,
30 "max_keys": 1000
31}
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_list_recycle_eip.py
Selective release of EIP
- Choose to either directly release the specified EIP or move it to the bucket trash. The default option is direct release.
- EIP instances with expired prepay, postpay-by-traffic, or postpay-by-bandwidth statuses can either be moved to the bucket trash or directly released.
- Once a specified EIP is released, it cannot be recovered.
- EIP instances in the bucket trash are retained for 7 days. After this period, they are automatically released and irreversible. During the 7 days, you can manually choose to restore or delete a specific EIP.
- If an EIP instance is bound to another instance, it must first be unbound before it can be released directly.
- When an EIP instance enters the bucket trash, all binding relationships are forcibly removed and need to be reconfigured if restored.
- EIPs in the bucket trash are subject to a quota of 10 per region, retained in reverse chronological order by default. If the number of EIPs in the bucket trash reaches 10, new entries will displace the oldest ones.
- If the EIP instance in postpay mode incurs debt, the system will automatically release it, regardless of the selected option.
Function declaration
1def optional_delete_eip(self, eip, release_to_recycle=False, client_token=None, config=None):
Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/zl0anqxgo
Response Value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_optional_delete_eip.py
Release EIPs in the bucket trash
- Release specified EIPs in the bucket trash.
Function declaration
1def delete_recycle_eip(self, eip, client_token=None, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/sl0anla1w
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_delete_recycle_eip.py
Restore EIPs in the bucket trash
- Restore billing for the specified EIP in the bucket trash
- If the EIP payment type is prepay, billing will be resumed through renewal, with a renewal duration of 1 month
- If the EIP payment type is postpayment, the original charge type will be restored
Function declaration
1def restore_recycle_eip(self, eip, client_token=None, config=None):
Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/EIP/s/Gl0anfp4g
Response value
Operation succeeded:
There are no special response parameters
Operation failed:
Throw an exception. For the exception list, refer to https://cloud.baidu.com/doc/EIP/s/Fk09snej9
Code example
For specific code examples, please refer to example_restore_recycle_eip.py
