Applies for an elastic IP address (EIP).

Descriptions

Before you call this operation, make sure that you understand the billing methods and pricing of EIPs. For more information, see Billing.

After you call this operation, the system randomly allocates an EIP that is in the Available state in the specified region. EIPs support only the following transport layer protocols: Internet Control Message Protocol (ICMP), Transmission Control Protocol (TCP), and User Datagram Protocol (UDP). Internet Group Management Protocol (IGMP) and Stream Control Transmission Protocol (SCTP) are not supported.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameter

Parameter Type Required Example Description
Action String Yes AllocateEipAddress

The operation that you want to perform. Set the value to AllocateEipAddress.

RegionId String Yes cn-hangzhou

The region ID of the EIP. You can call the DescribeRegions operation to query the most recent region list.

Bandwidth String No 5

The maximum bandwidth of the EIP. Valid values: 1 to 200. Unit: Mbit/s.

Default value: 5.

Period Integer No 1

The subscription duration of the EIP.

If the PricingCycle parameter is set to Month, valid values for the Period parameter are 1 to 9.

If the PricingCycle parameter is set to Year, valid values for the Period parameter are 1 to 5.

This parameter is required if the value of the InstanceChargeType parameter is set to PrePaid. If the value of the InstanceChargeType parameter is set to PostPaid, you do not need to set this parameter.

ISP String No BGP

The line type. You can set this parameter only when you create a pay-as-you-go EIP. Valid values:

  • BGP: BGP (Multi-ISP) lines.

    Up to 89 high-quality BGP lines are available worldwide. Direct connections with multiple Internet service providers (ISPs), including Telecom, Unicom, Mobile, Railcom, Netcom, CERNET, China Broadcast Network, Dr. Peng, and Founder, can be established in all regions in mainland China.

  • BGP_PRO: BGP (Multi-ISP) Pro lines.

    BGP (Multi-ISP) Pro lines optimize data transmission to China and improve connection quality for international services. Compared with BGP (Multi-ISP), when BGP (Multi-ISP) Pro provides services to users in mainland China (excluding data centers), cross-border connections are established by using mainland China ISP services. This reduces network latency.

BGP (Multi-ISP) lines are supported in all regions. BGP (Multi-ISP) Pro lines are supported only in the China (Hong Kong) region.

Note If your account is included in the BGP (single line) whitelist, you can set the ISP parameter to ChinaTelecom, ChinaUnicom, or ChinaMobile. If your workloads are deployed in China East 1 Finance, this parameter is required and you must set the value to BGP_FinanceCloud.
ActivityId Long No 123456

The promotion code. Ignore this parameter.

Netmode String No public

The network type. Set the value to public, which specifies public network.

AutoPay Boolean No false

Specifies whether to enable automatic payment. Valid values:

  • false: Automatic payment is disabled. After an order is generated, you must go to the Order Center to complete the payment.
  • true: Automatic payment is enabled. Payments are automatically completed.

If InstanceChargeType is set to PrePaid, this parameter is required. If InstanceChargeType is set to PostPaid, you do not need to set this parameter.

PricingCycle String No Month

The billing cycle of the subscription EIP. Valid values:

  • Month (default): The instance is billed on a monthly basis.
  • Year: The instance is billed on an annual basis.

    If InstanceChargeType is set to PrePaid, this parameter is required. If InstanceChargeType is set to PostPaid, you do not need to set this parameter.

InstanceChargeType String No PostPaid

The billing method of the EIP. Valid values:

  • PrePaid: subscription.
  • PostPaid: pay-as-you-go. This is the default value.

If the InstanceChargeType parameter is set to PrePaid, set the InternetChargeType parameter to PayByBandwidth. If the InstanceChargeType parameter is set to PostPaid, valid values for the InternetChargeType parameter are PayByBandwidth and PayByTraffic.

InternetChargeType String No PayByTraffic

The metering method of the EIP. Valid values:

  • PayByBandwidth (default): pay-by-bandwidth
  • PayByTraffic: pay-by-data-transfer

If the InstanceChargeType parameter is set to PrePaid, the InternetChargeType parameter must be set to PayByBandwidth.

If the InstanceChargeType parameter is set to PostPaid, valid values for the InternetChargeType parameter are PayByBandwidth and PayByTraffic.

ResourceGroupId String No rg-acfmxazffggds****

The ID of the resource group.

ClientToken String No 0c593ea1-3bea-11e9-b96b-88e9fe637760

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. ClientToken can contain only ASCII characters. It cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

Name String No EIP1

The name of the EIP.

Note This parameter is not available when you create a subscription EIP.
Description String No test

The description of the EIP.

Note This parameter is not available when you create a subscription EIP.

Response parameters

Parameter Type Example Description
EipAddress String 12.XX.XX.78

The allocated EIP.

AllocationId String eip-25877c70gddh****

The ID of the EIP.

OrderId Long 10

The order number. This parameter is returned only when the InstanceChargeType parameter is set to PrePaid.

RequestId String 4EC47282-1B74-4534-BD0E-403F3EE64CAF

The ID of the request.

ResourceGroupId String rg-acfmxazfdgdg****

The ID of the resource group.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AllocateEipAddress
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<ResourceGroupId>rg-acfmxazfdgdg****</ResourceGroupId>
<RequestId>4EC47282-1B74-4534-BD0E-403F3EE64CAF</RequestId>
<AllocationId>eip-25877c70gddh****</AllocationId>
<EipAddress>12.XX.XX.78</EipAddress>
<OrderId>10</OrderId>

JSON format

{"ResourceGroupId":"rg-acfmxazfdgdg****","RequestId":"4EC47282-1B74-4534-BD0E-403F3EE64CAF","AllocationId":"eip-25877c70gddh****","EipAddress":"12.XX.XX.78","OrderId":"10"}

Error codes

HttpCode Error code Error message Description
400 QuotaExceeded.Eip Elastic IP address quota exceeded The error message returned because the number of EIPs has reached the upper limit. To request a quota increase, submit a ticket. We recommend that you use NAT gateways.
400 InvalidParameter Specified value of "InternetChargeType" is not valid The error message returned because InternetChargeType is set to an invalid value.
400 InvalidParameter Specified value of "Bandwidth" is not valid. The error message returned because the specified maximum bandwidth is invalid.
400 InsufficientBalance Your account does not have enough balance. The error message returned because the balance in your account is insufficient. Top up your account and try again.
400 QuotaExceeded.Eip Elastic IP address quota exceeded. The error message returned because the number of EIPs has reached the upper limit. To request a quota increase, submit a ticket. We recommend that you use NAT gateways.
400 ReserveIpFail Reserve eip failed. The error message returned because the system failed to reserve the EIP.
400 InvalidRegion.NotSupport The specified region does not support. The error message returned because the specified region does not support this operation.
400 InvalidResourceGroupId The specified ResourceGroupId does not exist. The error message returned because the specified resource group ID is invalid.
400 ORDER.QUANTITY_INVALID User quota has exceeded the limit. The error message returned the number of EIPs that you have created has reached the upper limit. Go to the Quota Management page to request a quota increase.
403 Forbbiden User not authorized to operate on the specified resource. The error message returned because you are unauthorized to perform the operation on the specified resource. Apply for permissions and try again.
409 OperationConflict Request was denied due to conflict with a previos request. The error message returned because a request conflict occurs. Try again later or submit a ticket.

For a list of error codes, visit the API Error Center.