EIP Instance
Last Updated:2020-08-06
Apply for EIP
- Apply for an EIP, which can be used to bind to any BCC instance
- Identity Verification is required for creation of EIP, if you fail to pass identity verification, you can go to identity verification under security authentication in [Baidu Open Cloud Console](https://console.bce.baidu.com/qualify/? =1567871861163#/qualify/result) for authentication.
- Billing class can be referred to Billing.
public void createEip(EipClient eipClient, String name, int bandwidthInMbps, Billing billing) {
CreateEipRequest createEipRequest = new CreateEipRequest();
// Set name of created eip
createEipRequest.setName(name);
// Set public network bandwidth, in Mbps
createEipRequest.setBandwidthInMbps(bandwidthInMbps);
// Set order information
createEipRequest.setBilling(billing);
CreateEipResponse createEipResponse = eipClient.createEip(createEipRequest);
System.out.println(createEipResponse.getEip());
}
Capacity Expansion and Reduction of EIP Bandwidth
- Used for the bandwidth capacity expansion and reduction of specified EIP
- Check whether EIP capacity expansion and reduction state is completed by querying EIP list
public void resizeEip(EipClient eipClient, String eip��int bandwidthInMbps) {
eipClient.resizeEip(eip, bandwidthInMbps);
}
Bind EIP
- Bind EIP to an instance, and only BCC is supported currently.
- Only the EIP in available state supports binding operation.
- The bound instance cannot have any existing EIP binding relationship
- The bound instance cannot be in arrearage state.
public void bindEip(EipClient eipClient, String eip, String instanceId, String instanceType) {
eipClient.bindEip(eip, instanceId, instanceType);
}
Unbind EIP
- Unbind the specified EIP
- The unbound EIP must have been bound to any instance.
public void unbindEip(EipClient eipClient, String eip) {
eipClient.unbindEip(eip);
}
Release EIP
- Release the specified EIP, and the released EIP cannot be recovered.
- If EIP is bound to any instance, it can be released after unbinding.
public void releaseEip(EipClient eipClient, String eip) {
eipClient.releaseEip(eip);
}
Query EIP List
- EIP list can be queried according to multiple conditions.
- If it is only needed to query the details of a single EIP, you only need to provide eip parameters.
- If you only need to query the EIP bound to a specified instance, you only need to provide instanceType parameter.
- If you only need to query the details of EIP bound to a specified instance, you only need to provide instanceType and instanceId parameter.
- If no query condition is provided, the default query overwrites all EIPs.
- The returned result is the query result of intersection of multiple conditions, i.e. when multiple conditions are provided, EIP meeting all conditions simultaneously is returned.
- The query result above supports marker paging, with paging size of 1,000 by default, which can be specified via maxKeys parameter.
public void listEips(EipClient eipClient, String eip) {
ListEipsRequest listEipsRequest = new ListEipsRequest();
listEipsRequest.setEip(eip);
// Execute query list operation
ListEipsResponse listEipGroupResponse = eipClient.listEips(listEipsRequest);
for (EipModel eipModel : listEipGroupResponse.getEipList()) {
System.out.println(eipModel.getInstanceId());
}
}
Renew EIP
- For the renewal operation of specified EIP, extend the expiration time
- No renewal operation can be conducted during EIP capacity expansion and reduction.
public void purchaseReservedEip(EipClient eipClient, String eip, int reservationLength, String reservationTimeUnit) {
eipClient.purchaseReservedEip(eip, reservationLength, reservationTimeUnit);
}