AllocateEipAddresses

1. API Description

This API is used to apply for one or multiple elastic IPs.

Prerequisites

  • Query available elastic IPs in zone: call DescribeEipAvailableResources to check the stock of the specified zone.

  • Cost estimation: know of the pricing model of elastic IPs. See Elastic IP for details.

Note

  • If you create a subscription elastic IP, the amount required will be pre-deducted. If the balance is insufficient, the request will fail. If you create a pay-as-you-go elastic IP, please ensure your account balance is sufficient before calling this API.

  • Vouchers can be used for fee deduction in creation. See Vouchers for more details.

  • This API is an async API. An ID list is returned after the request is sent. However, it does not mean the creation has been completed. The status of the elastic IP will be or CREATING during the creation. You can use DescribeEipAddresses to query the status of the elastic IP. If the status changes from Creating to Available, it means that the elastic IP has been created successfully; CREATE_FAILED means the elastic IP has been created failed. Any operations on the elastic IPs are not allowed while creating.

  • A maximum of 100 elastic IPs can be created in one request.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter NameRequiredTypeDescription

zoneId

Yes

String

Zone ID to which the elastic IPs belong.

eipChargeType

Yes

String

Elastic IP pricing model.

PREPAID: subscription

POSTPAID: pay-as-you-go

eipChargePrepaid

No

Details of the monthly subscription, including the purchase period, auto-renewal. It is required if the eipChargeType is PREPAID.

amount

No

Integer

Quantity of elastic IPs.

Value range: 1-100.

Default value: 1.

resourceGroupId

No

String

Resource group ID

If the value is not passed in, the elastic IP will be put into the default resource group. If no authorized default resource group found, the request will fail.

3. Output Parameters

Parameter NameTypeDescription

eipIdSet

Array of String

ID list of elastic IPs. The returned ID list does not mean the creation has been completed. You can call DescribeEipAddresses to query the status of the elastic IPs. If the status changes from Creating to Available, it means that the elastic IPs have been created successfully.

orderNumber

String

Number of order.

This parameter returns when eipChargeType is PREPAID.

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Code Example

Create a pay-as-you -go elastic IP with the simplest parameters in zone: SEL-A

POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: AllocateEipAddresses
<Common Request Params>

Request:
{
    "eipChargeType": "POSTPAID",
    "zoneId": "SEL-A"
}

Response:
{
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "response": {
        "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
        "eipIdSet": ["eipId1"],
        "orderNumber" : ""
    }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.​

HTTP Status CodeError CodeDescription

404

INVALID_ZONE_NOT_FOUND

Zone does not exist.

400

INVALID_EIP_TYPE_ZONE_NO_SELL

Elastic IPs not available for sale in zone.

400

MISSING_PARAMETER

The parameter is empty.

Last updated