Creates an Elastic IP Address (EIP).

Issues to note

Before you call this API, make sure that you have known the billing methods and prices of EIPs. For more information, see Billing method.

After you call this API, an EIP in the Available state is allocated in the specified region. EIP supports ICMP, TCP, and UDP protocols, but does not support the IGMP and SCTP protocols.

Debug

Use OpenAPI Explorer to perform debug operations and generate SDK code examples.

Request parameters

Parameter Type Required? Example value Description
Action String  Yes AllocateEipAddress

The name of this action. Value: AllocateEipAddress

RegionId String  Yes cn-hangzhou

The ID of the region to which the EIP belongs. To query the region ID, call DescribeRegions.

AutoPay Boolean No false

Indicates whether to pay automatically. Leave this parameter blank.

Bandwidth String  No 5

Optional. The peak bandwidth of the EIP. Unit: Mbit/s. Default value: 5

ClientToken String  No 02fb3da4-130e-11e9-8e44-001****

Optional. The client token used to guarantee the idempotence of the request. The value of this parameter is generated by the client. The value is unique among different requests and 1 to 64 ASCII characters in length.

ISP String  No BGP

Optional. The type of the line. Default value: BGP.

  • If you have enabled a single-line bandwidth whitelist, you can set the ISP parameter to ChinaTelecom, ChinaUnicom or ChinaMobile to enable a single-line EIP provided by China Telecom, China Unicom, and China Mobile respectively.
  • This parameter is required if you are a financial cloud user and select the Hangzhou region. Value: BGP_FinanceCloud
InstanceChargeType String  No PostPaid

The payment method of the EIP. Value: PostPaid (Pay-As-You-Go). The value of the InternetChargeType parameter must be PayByTraffic. For more information about the Pay-As-You-Go billing method, see Pay-As-You-Go.

InternetChargeType String  No PayByTraffic

Optional. The billing method of the EIP. Value: PayByTraffic, which means traffic-based billing. For more information, see Traffic-based billing.

Netmode String  No Public

Optional. The network type. Default value: Public

Period Integer No 1

The purchase period. Leave this parameter blank.

PricingCycle String No Month

The billing cycle of Subscription. Leave this parameter blank.

ResourceGroupId String  No rg-acfmxazffggds****

Optional. The ID of the enterprise resource group.

Response parameters

Parameter Type Example value Description
EipAddress String 12.xx.xx.78

The created EIP.

AllocationId String eip-25877c70gddh****

The ID of the EIP.

OrderId Long 10

The order number, which is returned only when InstanceChargeType is set to PrePaid.

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

The request ID.

ResourceGroupId String rg-acfmxazfdgdg****

The ID of the enterprise resource group.

Examples

Request example


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

Response examples

XML format

<AllocateEipAddressResponse>
      <AllocationId>eip-25877c70gfdkh****</AllocationId>
      <EipAddress>123.xx.xx.206</EipAddress>
      <RequestId>B6B9F518-60F8-4D81-9242-1207B356754D</RequestId>
</AllocateEipAddressResponse>

JSON format

{
	"RequestId":"B6B9F518-60F8-4D81-9242-1207B356754D",
	"EipAddress":"123.xx.xx.206",
	"AllocationId":"eip-25877c70gfdkh****"
}

Errors

HTTP status code Error code Error message Description
403 Forbbiden User not authorized to operate on the specified resource. You are not authorized to operate on this resource.
400 QuotaExceeded.Eip Elastic IP address quota exceeded The quota of EIPs has been reached. To increase the quota, open a ticket. Alternatively, we recommend that you use NAT Gateway to obtain more IP addresses.
400 InvalidParameter Specified value of "InternetChargeType" is not valid The value of the InternetChargeType parameter is invalid.
400 InvalidParameter Specified value of "Bandwidth" is not valid. The specified bandwidth value is invalid.
400 QuotaExceeded.Eip Elastic IP address quota exceeded. The quota of EIPs has been reached. To increase the quota, open a ticket. Alternatively, we recommend that you use NAT Gateway to obtain more IP addresses.
400 ReserveIpFail Reserve eip failed. The operation to reserve the EIP failed.
400 InvalidRegion.NotSupport The specified region does not support. The specified region does not support this operation.

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