All Products
Search
Document Center

:AllocateEipAddress

更新時間:Aug 30, 2023

Applies for an elastic IP address (EIP).

Usage notes

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

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 ICMP, TCP, and UDP transport layer protocols. The IGMP and SCTP protocols 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 parameters

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 ID of the region to which the EIP belongs.

You can call the DescribeRegions operation to query the most recent region list.

Bandwidth String No 5

The maximum bandwidth of the EIP. Unit: Mbit/s.

  • When InstanceChargeType is set to PostPaid and InternetChargeType is set to PayByBandwidth, the valid values for Bandwidth are 1 to 500.

  • When InstanceChargeType is set to PostPaid and InternetChargeType is set to PayByTraffic, valid values for Bandwidth are 1 to 200.

  • When InstanceChargeType is set to PrePaid, valid values for Bandwidth are 1 to 1000.

Default value: 5. Unit: Mbit/s.

Period Integer No 1

The subscription duration of the instance.

When PricingCycle is set to Month, valid values for Period are 1 to 9.

When PricingCycle is set to Year, valid values for Period are 1 to 5.

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

ISP String No BGP

The line type. Valid values:

  • BGP (default) All regions support BGP (Multi-ISP) EIPs.
  • BGP_PRO Only the following regions support BGP (Multi-ISP) Pro lines: China (Hong Kong), Singapore, Japan (Tokyo), Malaysia (Kuala Lumpur), Philippines (Manila), Indonesia (Jakarta), and Thailand (Bangkok).

For more information about BGP (Multi-ISP) and BGP (Multi-ISP) Pro, see EIP line types.

  • If you are allowed to use single-ISP bandwidth, you can also use one of the following values:
    • ChinaTelecom
    • ChinaUnicom
    • ChinaMobile
    • ChinaTelecom_L2
    • ChinaUnicom_L2
    • ChinaMobile_L2
  • If your services are deployed in China East 1 Finance, you must set this parameter 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 (default).

AutoPay Boolean No false

Specifies whether to enable automatic payment. Valid values:

  • false: disables automatic payment. This is the default value. If you select this option, you must go to the Order Center to complete the payment after an order is generated.

  • true: enables automatic payment. Payments are automatically completed.

When InstanceChargeType is set to PrePaid, this parameter is required. When InstanceChargeType is set to PostPaid, this parameter is not required.

PricingCycle String No Month

The billing cycle of the subscription EIP. Valid values:

  • Month (default)
  • Year

When InstanceChargeType is set to PrePaid, this parameter is required. When InstanceChargeType is set to PostPaid, this parameter is not required.

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, set InternetChargeType to PayByBandwidth. When InstanceChargeType is set to PostPaid, set InternetChargeType to PayByBandwidth or PayByTraffic.

InternetChargeType String No PayByTraffic

The metering method of the EIP. Valid values:

  • PayByBandwidth (default): pay-by-bandwidth

  • PayByTraffic: pay-by-data-transfer

When InstanceChargeType is set to PrePaid, you must set InternetChargeType to PayByBandwidth.

When InstanceChargeType is set to PostPaid, set InternetChargeType to PayByBandwidth or 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 token, but you must make sure that the token is unique among different requests. The client token can contain only ASCII characters.

Note

If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.

Name String No EIP1

The name of the EIP.

The name must be 1 to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). It must start with a letter.

Note

This parameter is unavailable when you create a subscription EIP.

Description String No test

The description of the EIP.

The description must be 2 to 256 characters in length. It must start with a letter but cannot start with http:// or https://.

Note

This parameter is unavailable when you create a subscription EIP.

SecurityProtectionTypes.N String No AntiDDoS_Enhanced

The edition of Anti-DDoS.

  • If you do not set this parameter, Anti-DDoS Origin Basic is used by default.

  • If you set the value to AntiDDoS_Enhanced, Anti-DDoS Pro/Premium is used.

You can set up to 10 editions of Anti-DDoS.

PublicIpAddressPoolId String No pippool-2vc0kxcedhquybdsz****

The ID of the IP address pool.

The EIP is allocated from the IP address pool.

You cannot use the IP address pool feature by default. To use the IP address pool feature, apply for the privilege in the Quota Center console. For more information, see Request a quota increase in the Quota Center console.

Zone String No ap-southeast-1-lzdvn-cb

The zone of the EIP.

When the service type of the IP address pool specified by PublicIpAddressPoolId is CloudBox, the default value is the zone of the IP address pool.

For more information, see ListPublicIpAddressPools.

IpAddress String No 192.0.XX.XX

The IP address of the EIP that you want to request.

Specify IpAddress or InstanceId. If you leave both parameters empty, the system randomly allocates an EIP.

InstanceId String No eip-25877c70gddh****

The ID of the EIP.

Specify IpAddress or InstanceId. If you leave both parameters empty, the system randomly allocates an EIP.

Response parameters

Parameter

Type

Example

Description

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

The request ID.

OrderId Long 10

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

ResourceGroupId String rg-acfmxazfdgdg****

The ID of the resource group. This parameter is returned only when InstanceChargeType is set to PostPaid.

EipAddress String 192.0.XX.XX

The EIP that is allocated. This parameter is returned only when InstanceChargeType is set to PostPaid.

AllocationId String eip-25877c70gddh****

The ID of the EIP.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AllocateEipAddress
&RegionId=cn-hangzhou
&Bandwidth=5
&Period=1
&ISP=BGP
&ActivityId=123456
&Netmode=public
&AutoPay=false
&PricingCycle=Month
&InstanceChargeType=PostPaid
&InternetChargeType=PayByTraffic
&ResourceGroupId=rg-acfmxazffggds****
&ClientToken=0c593ea1-3bea-11e9-b96b-88e9fe637760
&Name=EIP1
&Description=test
&SecurityProtectionTypes=["AntiDDoS_Enhanced"]
&PublicIpAddressPoolId=pippool-2vc0kxcedhquybdsz****
&Zone=ap-southeast-1-lzdvn-cb
&IpAddress=192.0.XX.XX
&InstanceId=eip-25877c70gddh****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode

Error code

Error message

Description

400 InvalidParameter Specified value of "Bandwidth" is not valid. The specified bandwidth value is invalid.
400 InsufficientBalance Your account does not have enough balance. You do not have sufficient balance within your Alibaba Cloud account. Top up your Alibaba Cloud account and try again.
400 QuotaExceeded.Eip Elastic IP address quota exceeded. The number of EIPs has reached the upper limit. We recommend that you use NAT gateways if you want to use more EIPs.
400 ReserveIpFail Reserve eip failed. The system failed to reserve the specified EIP.
400 InvalidRegion.NotSupport The specified region does not support. The operation is not supported in the specified region.
400 InvalidResourceGroupId The specified ResourceGroupId does not exist. The specified resource group ID does not exist.
400 OperationFailed.RiskControl Risk control check failed. Security risks are detected in your payment method. Click the link in the email that is sent to you or in the ApsaraDB RDS console to continue with the verification. After you complete the verification, submit the order again.
400 OperationFailed.SaleValidate Validate sale condition with subArticle failed. Failed to validate the sales condition with a subproject.
400 OperationFailed.QueryPrice Query price failed when create order. Failed to query the price when creating the order.
400 ORDER.QUANTITY_INVALID User quota has exceeded the limit. The number of EIPs that you have created has reached the upper limit. Go to the Quota Management page to request a quota increase.
400 OrderError.EIP The Account failed to create order. The system failed to generate the order.
400 CreditPayInsufficientBalance The balance is insufficient, please contact your channel partner to increase the balance Your Alibaba Cloud account does not have a sufficient balance. Make sure that you have a sufficient balance in your Alibaba Cloud account.
400 OperationDenied.NotOpenDdosOriginProtectService The operation is not allowed because of you do not open Ddos Origin Protection Service You have not purchased the anti-DDoS service and you cannot create an EIP with anti-DDoS Pro/Premium enabled.
400 IncorrectStatus.PublicIpAddressPool The status of PublicIpAddressPool is incorrect. The IP address pool is in an unstable state and EIPs cannot be allocated.
400 IncorrectStatus.PublicIpAddressPool The status of %s [%s] is incorrect. The IP address pool is in an invalid state and EIPs cannot be allocated.
400 IllegalParam.Isp The param of %s is illegal. The ISP is invalid and EIPs cannot be allocated.
400 AccountMoneyValidateError The available amount of the account is insufficient. The account does not have sufficient balance.
400 OrderFailed.ConcurrentOperate Failed to create the order due to concurrent operations. Concurrent operations are performed and the system failed to create an order.
400 OperationFailed.BasicInfoUncompleted Your information is incomplete. Complete your information before the operation. Your basic information is incomplete. Complete your basic information and try again.
400 OperationFailed.QuotaNotEnough Your quota is insufficient. Please contact your channel partner to increase your quota The quota is insufficient. You can contact your channel partner to request a quota increase.
400 ExclusiveParam.ZoneAndPublicIpAddressPoolId The Zone and PublicIpAddressPoolId parameters are mutually exclusive. You cannot specify Zone and PublicIpAddressPoolId at the same time.
400 IllegalParam.Zone The specified zone is invalid. Zone is set to an invalid value.
400 OperationFailed.AllocateUnfamiliarIp The operation failed because only IP addresses used within the last seven days can be allocated. Only IP addresses used within the last seven days can be used to apply for EIP.
400 Ip.Allocated The reserve ip has been allocated. Reserved IP addresses are already specified.
400 IncorrectStatus.Ip The status of ip is incorrect. The status of the IP address is invalid.
400 UnsupportedFeature.AllocateEipAddressWithZone The feature of AllocateEipAddressWithZone is not supported. You are not allowed to create an instance in a specified zone in the region.
400 ResourceNotFound.Ip The specified ip is not found. The specified IP address does not exist.
403 Forbidden User not authorized to operate on the specified resource. You are unauthorized to manage the specified resource. Acquire the required permissions and try again.
409 OperationConflict Request was denied due to conflict with a previous request. Your request is conflicting with another request. Try again later.
500 InternalError The request processing has failed due to some unknown error, exception or failure. An internal error has occurred.

For a list of error codes, see Service error codes.