Creates an Elastic IP Address (EIP).

API description

Make sure that you fully understand the billing method and prices of EIPs. For more information, see Billing overview.

A random EIP instance in the status of Available is created after this action. EIPs only support ICMP, TCP, and UDP protocols at the transport layer, and do not support IGMP, SCTP, or other protocols.

Make the API call

You can use OpenAPI Explorer to make API calls, search for API calls, perform debugging, and generate SDK example code.

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.

ActivityId Long No 11111

The special activity ID. Ignore this parameter.

AutoPay Boolean No false

Indicates whether to enable automatic payment.

false: Do not enable automatic payment. Bills need to be paid manually on the Billing Management page.

true: Enable automatic payment. Bills are paid automatically.

This parameter is required when InstanceChargeType is set to PrePaid. This parameter is optional if InstanceChargeType is set to PostPaid.

Note This parameter cannot be configured on the international site.
Bandwidth String No 5

The peak bandwidth of the EIP. Value range: 1~200. Unit: Mbps.

Default value: 5.

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

The client token that guarantees the idempotence of the request. The value of this parameter is generated by the client and is unique among different requests. The ClientToken parameter can be up to 64 characters in length and must contain only ASCII characters. For more information, see How to ensure idempotence.

ISP String No BGP

The type of the line. Default value: BGP.

  • If your account is whitelisted for the single-line bandwidth, you can set the ISP field to ChinaTelecom, ChinaUnicom or ChinaMobile to activate single-line EIPs of China Telecom, China Unicom, or China Mobile.
  • This parameter is required if you are a financial cloud user. Valid value: BGP_FinanceCloud.
InstanceChargeType String No PostPaid

The billing method of the EIP. Valid values:

PrePaid: Subscription.

PostPaid(default): Pay-as-you-go.

When InstanceChargeType is set to PrePaid, the value of InternetChargeType must be PayByBandwidth. When InstanceChargeType is set to PostPaid, the value of InternetChargeType can be PayByBandwidth or PayByTraffic.

Note This parameter can only be set to PostPaid on the international site.
InternetChargeType String No PayByTraffic

The metering method of the EIP. Valid values:

PayByBandwidth (default): Pay by bandwidth.

PayByTraffic: Pay by traffic.

When InstanceChargeType is set to PrePaid, the value of InternetChargeType must be PayByBandwidth.

When InstanceChargeType is set to PostPaid, the value of InternetChargeType can be PayByBandwidth or PayByTraffic.

Netmode String No public

The network type. Valid value: public (public network).

Period Integer No 1

The purchased period.

When PricingCycle is set to Month, the value range of Period is 1~9.

When PricingCycle is set to Year, the value range of Period is 1~3.

This parameter is required when InstanceChargeType is set to PrePaid. Ignore this parameter when InstanceChargeType is set to PostPaid.

Note This parameter cannot be configured on the international site.
PricingCycle String No Month

The billing cycle of subscription EIPs. Valid values:

Month (default): Bills are paid on a monthly basis.

Year: Bills are paid on a yearly basis.

This parameter is required when InstanceChargeType is set to PrePaid. This parameter is optional when InstanceChargeType is set to PostPaid.

Note This parameter cannot be configured on the international site.
ResourceGroupId String No rg-acfmxazffggds****

The ID of the enterprise resource group.

Response parameters

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

The assigned EIP.

AllocationId String eip-25877c70gddh****

The instance ID of the EIP.

OrderId Long 10

The order number. It is returned only when the value of InstanceChargeType is PrePaid.

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

The ID of the request.

ResourceGroupId String rg-acfmxazfdgdg****

The ID of the enterprise resource group.

Examples

Request example


http(s)://vpc.aliyuncs.com/? Action=AllocateEipAddress
&RegionId=cn-hangzhou
&<Common request parameters>

Response example

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 number of EIPs exceeds the quota. If you need more EIPs, open a ticket to increase the quota. We recommend that you use NAT Gateway.
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 is invalid.
400 InsufficientBalance Your account does not have enough balance. Your account balance is insufficient.
400 QuotaExceeded.Eip Elastic IP address quota exceeded. The number of EIPs exceeds the quota. If you need more EIPs, open a ticket to increase the quota. We recommend that you use NAT Gateway.
400 ReserveIpFail Reserve eip failed. The EIP cannot be reserved.
400 InvalidRegion.NotSupport The specified region does not support. The specified region ID does not support this operation.
409 OperationConflict Request was denied due to conflict with a previous request. A request conflict occurs. Try again later.

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