EIP实例
更新时间:2023-08-31
申请EIP
- 申请一个EIP,可用于绑定到任意BCC实例
- 创建EIP需要实名认证,若未通过实名认证可以前往百度开放云官网控制台中的安全认证下的实名认证中进行认证。
def test_create_eip(eip_client, bandwidth_in_mbps, name, billing):
response = eip_client.create_eip(bandwidth_in_mbps, name, billing)
print response
EIP带宽扩缩容
- 用于指定EIP的带宽扩缩容
- 通过查询EIP列表查看EIP扩缩容状态是否完成
def test_resize_eip(eip_client, eip, new_bandwidth_in_mbps):
response = eip_client.resize_eip(eip, new_bandwidth_in_mbps)
print response
绑定EIP
- 绑定EIP到某个实例,当前仅支持BCC
- 只有available状态的EIP支持绑定操作
- 被绑定的实例不能存在任何已有EIP绑定关系
- 被绑定的实例不能处于欠费状态
def test_bind_eip(eip_client, eip, instance_type, instance_id):
response = eip_client.bind_eip(eip, instance_type, instance_id)
print response
解绑EIP
- 解除指定EIP的绑定关系
- 被解绑的EIP必须已经绑定到任意实例
def test_unbind_eip(eip_client, eip):
response = eip_client.unbind_eip(eip)
print response
释放EIP
- 释放指定EIP,被释放的EIP无法找回
- 如果EIP被绑定到任意实例,需要先解绑才能释放
def test_release_eip(eip_client, eip):
response = eip_client.release_eip(eip)
print response
查询EIP列表
- 可根据多重条件查询EIP列表。
- 如只需查询单个EIP的详情,只需提供eip参数即可。
- 如只需查询绑定到指定类型实例上的EIP,提供instanceType参数即可。
- 如只需查询指定实例上绑定的EIP的详情,提供instanceType及instanceId参数即可。
- 若不提供查询条件,则默认查询覆盖所有EIP。
- 返回结果为多重条件交集的查询结果,即提供多重条件的情况下,返回同时满足所有条件的EIP。
- 以上查询结果支持marker分页,分页大小默认为1000,可通过maxKeys参数指定。
def test_list_eips(eip_client, eip, instance_type, instance_id, marker, max_keys):
response = eip_client.list_eips(eip, instance_type, instance_id, marker, max_keys)
print response
EIP续费
- 针对指定EIP的续费操作,延长过期时长
- EIP扩缩容期间不能进行续费操作。
def test_purchase_reserved_eip(eip_client, eip, billing):
response = eip_client.purchase_reserved_eip(eip, billing)
print response