All Products
Search
Document Center

Virtual Private Cloud:AllocateEipAddress

Last Updated:Nov 13, 2024

Applies for an elastic IP address (EIP).

Operation description

Before you call this operation, make sure that you are familiar with 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
vpc:AllocateEipAddresscreate
  • Address
    acs:vpc:{#regionId}:{#accountId}:eip/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The ID of the region to which the EIP belongs.

You can call the DescribeRegions operation to query the region ID.

cn-hangzhou
BandwidthstringNo

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

  • Valid values when InstanceChargeType is set to PostPaid and InternetChargeType is set to PayByBandwidth: 1 to 500.****
  • Valid values when InstanceChargeType is set to PostPaid and InternetChargeType is set to PayByTraffic: 1 to 200.****
  • Valid values when InstanceChargeType is set to PrePaid: 1 to 1000.****

Default value: 5. Unit: Mbit/s.

5
PeriodintegerNo

The subscription duration of the EIP.

Valid values when PricingCycle is set to Month: 1 to 9.****

Valid values when PricingCycle is set to Year: 1 to 5.****

This parameter must be specified when InstanceChargeType is set to PrePaid. This parameter is optional when InstanceChargeType is set to PostPaid.

1
ISPstringNo

The line type. Valid values:

  • BGP (default): BGP (Multi-ISP) All regions support BGP (Multi-ISP) EIPs.
  • BGP_PRO: BGP (Multi-ISP) 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 the "Line types" section of What is EIP?

  • If you are allowed to use single-ISP bandwidth, you can also choose one of the following values:

    • ChinaTelecom
    • ChinaUnicom
    • ChinaMobile
    • ChinaTelecom_L2
    • ChinaUnicom_L2
    • ChinaMobile_L2
  • If your services are deployed in China East 1 Finance, this parameter is required and you must set the value to BGP_FinanceCloud.

BGP
ActivityIdlongNo

The promotion code. This parameter is not required.

123456
NetmodestringNo

The network type. Default value: public.

public
AutoPaybooleanNo

Specifies whether to enable automatic payment. Valid values:

  • false (default): The automatic payment is disabled. If you select this option, you must go to the Order Center to complete the payment after an order is generated.
  • true: The automatic payment is enabled. Payments are automatically complete after an order is generated.

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

false
PricingCyclestringNo

The billing cycle of the subscription EIP. Valid values:

  • Month (default)
  • Year

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

Month
InstanceChargeTypestringNo

The billing method of the EIP. Valid values:

  • PrePaid: subscription
  • PostPaid (default): pay-as-you-go

If InstanceChargeType is set to PrePaid, set InternetChargeType to PayByBandwidth. If InstanceChargeType is set to PostPaid, set InternetChargeType to PayByBandwidth or PayByTraffic.

PostPaid
InternetChargeTypestringNo

The metering method of the EIP. Valid values:

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

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

When InstanceChargeType is set to PostPaid, set InternetChargeType to PayByBandwidth or PayByTraffic.

PayByTraffic
ResourceGroupIdstringNo

The ID of the resource group.

rg-acfmxazffggds****
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request.

You can use the client to generate a 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 value of RequestId as the client token. The value of RequestId is different for each API request.
0c593ea1-3bea-11e9-b96b-88e9fe637760
NamestringNo

The EIP name.

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

Note You cannot specify this parameter if you create a subscription EIP.
EIP1
DescriptionstringNo

The description of the EIP.

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

Note You cannot specify this parameter if you create a subscription EIP.
test
SecurityProtectionTypesarrayNo

The editions of Anti-DDoS.

  • If you do not specify this parameter, Anti-DDoS Origin Basic is used.
  • If you set the parameter to AntiDDoS_Enhanced, Anti-DDoS Pro/Premium is used.

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

stringNo

The edition of Anti-DDoS.

  • If you do not specify this parameter, Anti-DDoS Origin Basic is used.
  • If you set the parameter to AntiDDoS_Enhanced, Anti-DDoS Pro/Premium is used.

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

AntiDDoS_Enhanced
PublicIpAddressPoolIdstringNo

The ID of the IP address pool.

The EIP is allocated from the IP address pool.

By default, the IP address pool feature is unavailable. To use the IP address pool, apply for the privilege in the Quota Center console. For more information, see the "Request a quota increase in the Quota Center console" section in Manage EIP quotas.

pippool-2vc0kxcedhquybdsz****
ZonestringNo

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 .

cn-hangzhou-a
IpAddressstringNo

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.

192.0.XX.XX
InstanceIdstringNo

The EIP ID.

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

eip-25877c70gddh****

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

4EC47282-1B74-4534-BD0E-403F3EE64CAF
OrderIdlong

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

10
ResourceGroupIdstring

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

rg-acfmxazfdgdg****
EipAddressstring

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

192.0.XX.XX
AllocationIdstring

The EIP ID.

eip-25877c70gddh****

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400COMMODITY_NO_EXISTcommodity is not exist-
400QuotaExceeded.EipElastic IP address quota exceeded-
400InvalidParameterSpecified value of "InternetChargeType" is not valid-
400InvalidParameterSpecified value of "Bandwidth" is not valid.The specified bandwidth value is invalid.
400InsufficientBalanceYour account does not have enough balance.Your account balance is insufficient. Top up your account and try again.
400QuotaExceeded.EipElastic 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.
400ReserveIpFailReserve eip failed.The system failed to reserve the specified EIP.
400InvalidRegion.NotSupportThe specified region does not support.The specified region does not support.
400InvalidBandwidth.MalformedThe specified Bandwidth is invalid.-
400INSTANCE_TYPE_NOT_SUPPORTThe instance type is invalid.-
400QueryParameter.Illegalquery parameter illegal-
400TokenVerfiy.Failedtoken verify failed.-
400OrderFailedThe Account failed to create order.-
400QuotaExceeded.LargeSpecEipElastic IP address with large spec quota exceeded.-
400InvalidResourceGroupIdThe specified ResourceGroupId does not exist.The specified resource group ID does not exist.
400PAYFOR.CREDIT_PAY_INSUFFICIENT_BALANCEYour account does not have enough balance.-
400SYSTEM.SALE_VALIDATE_UNEXPECTED_ERRORYou have arrears and do not meet the purchase conditions.-
400Trade_Sync_Create_Sub_ERRORSyncOrderToSub error.-
400InvalidComponent.EipBandwidthMaxThe eip_bandwidth_max component is invalid.-
400OperationFailed.RiskControlRisk control check failed.The error message returned because your payment method has security risks. Click the link for verification in your email or console message and submit your order after verification.
400OperationFailed.SaleValidateValidate sale condition with subArticle failed.Failed to validate the sales condition with a subproject.
400IllegalParam.OrderParamComponentProduct order param has invalid component.-
400OperationFailed.SaleExpressionGet the sales expression exception attached to the item.-
400OperationFailed.CompleteUserInfoComplete user info failed.-
400OperationFailed.QueryPriceQuery price failed when create order.Failed to query the price when creating the order.
400OperationFailed.InsufficientEIPEip resource is not enough.-
400OperationFailed.InvokeInnerApiFailed to invoke inner api.-
400OperationFailed.AccountMoneyInvalidAccount money is invalid.-
400OperationFailed.QueryCredtiInfoFailed to query credit info.-
400FrequentPurchase.EIPeip frequent purchase-
400OperationFailed.QueryUserLabelFailed to query user label info.-
400PAY.INSUFFICIENT_BALANCEYour account does not have enough balance.Your account does not have enough balance.
400ORDER.QUANTITY_INVALIDUser quota has exceeded the limit.The maximum number of EIPs you maintain is exceeded. You can go to quota management to increase the upper limit of EIPs.
400PAY.MAYI_WITHHOLDING_AGREEMENT_ILLEGALUser withhoding argeement is illegal.-
400OrderError.EIPFThe Account failed to create order.-
400IellgalParameter.OwnerAccountThe specified parameter OwnerAccount is not valid.The specified parameter OwnerAccount is illegal.
400OrderError.EIPThe Account failed to create order.Failed to place the order.
400ResourceNotFound.PublicIpAddressPoolThe specified resource of PublicIpAddressPool is not found.-
400ResourceNotEnough.PublicIpAddressPoolThe specified resource of PublicIpAddressPool is not enough.-
400Mismatch.IpAndPublicIpAddressPoolThe Ip and PublicIpAddressPool are mismatched.-
400CreditPayInsufficientBalanceThe balance is insufficient, please contact your channel partner to increase the balanceThe quota is insufficient. Contact your partner to increase the quota.
400OperationDenied.NotOpenDdosOriginProtectServiceThe operation is not allowed because of you do not open Ddos Origin Protection ServiceYou can not create an anti-DDoS Enhanced EIP because you do not open Ddos Origin Protection Service.
400IncorrectStatus.PublicIpAddressPoolThe status of PublicIpAddressPool is incorrect.EIPs are not allowed to be allocated because the address pool is in an unstable state.
400IncorrectStatus.PublicIpAddressPoolThe status of %s [%s] is incorrect.The EIP cannot be allocated because the IP address pool is in an invalid state.
400IllegalParam.IspThe param of %s is illegal.The EIP cannot be allocated because the ISP is invalid.
400AccountMoneyValidateErrorThe available amount of the account is insufficient.The account does not have sufficient balance.
400OrderFailed.ConcurrentOperateFailed to create the order due to concurrent operations.Failed to create the order because concurrent operations are performed.
400OperationFailed.BasicInfoUncompletedYour information is incomplete. Complete your information before the operation.The error message returned because your basic information is incomplete. Complete your basic information and try again.
400OperationFailed.QuotaNotEnoughYour quota is insufficient. Please contact your channel partner to increase your quota-
400ExclusiveParam.ZoneAndPublicIpAddressPoolIdThe Zone and PublicIpAddressPoolId parameters are mutually exclusive.You cannot specify Zone and PublicIpAddressPoolId at the same time.
400IllegalParam.ZoneThe specified zone is invalid.Zone is set to an invalid value.
400OperationFailed.AllocateUnfamiliarIpThe 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.
400Ip.AllocatedThe reserve ip has been allocated.Reserved IP addresses are already specified.
400IncorrectStatus.IpThe status of ip is incorrect.The status of the IP is incorrect.
400UnsupportedFeature.AllocateEipAddressWithZoneThe feature of AllocateEipAddressWithZone is not supported.You are not allowed to create an instance in a specified zone in the region.
400ResourceNotFound.IpThe specified ip is not found.The specified IP could not be found.
400OperationFailed.CreditPayInsufficientBalanceYour account does not have enough balance.Your account balance is negative. Top up your account before you can make a purchase.
400OperationFailed.ResourceNotEnoughThe resources you have applied for are insufficient.The resources you have applied for are insufficient. If you still need to apply, please submit a work order for processing.
403ForbiddenUser not authorized to operate on the specified resource.You do not have the permissions to manage the specified resource. Apply for the permissions and try again.
404InvalidRegionId.NotFoundSpecified value of "RegionId" is not supported.RegionId is set to an invalid value. Check whether the service is available in the specified region and try again.
404InvalidRegionId.NotFoundThe RegionId provided does not exist in our records.The RegionId parameter is set to an invalid value. Specify a valid value and try again.
404FUWU_BIZ_COMMODITY_VERIFY_FAIL????????, ????????PD.-
409OperationConflictRequest was denied due to conflict with a previous request.The request conflicts with another one. Try again later.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.An internal error occurred.
500OperationFailed.SystemBusyOperation failed because system is busy.The error message returned because the system is busy. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-07-16The Error code has changedView Change Details
2024-05-17The Error code has changedView Change Details
2024-03-14The Error code has changedView Change Details
2024-03-14The Error code has changedView Change Details
2024-02-02The Error code has changedView Change Details
2024-01-22The Error code has changedView Change Details
2023-12-13The Error code has changedView Change Details
2023-10-19The Error code has changedView Change Details
2023-08-29The Error code has changedView Change Details
2023-07-26The Error code has changedView Change Details
2023-07-24API Description Update. The Error code has changedView Change Details
2023-07-08The Error code has changedView Change Details
2023-07-06The Error code has changedView Change Details
2023-06-26The Error code has changedView Change Details
2023-06-19The Error code has changed. The request parameters of the API has changedView Change Details
2023-04-20The Error code has changed. The request parameters of the API has changedView Change Details
2023-03-09The Error code has changedView Change Details
2022-12-02The Error code has changedView Change Details