InquiryPriceCreateInstance

1. API Description

This API is used to query the price of creating an elastic compute instance.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

zoneId

Yes

String

Zone ID to which the instance belongs.

instanceType

Yes

String

Instance type. Specific values can be obtained by calling the interface DescribeZoneInstanceConfigInfos.

eipV4Type

Yes

String

The network type of the public IPv4. Ensure that the stack type of the selected subnet supports IPv4.

See eipV4Type for available values.

LocalLine and ThreeLine are not currently supported.

internetChargeType

Yes

String

Network billing method.

See InternetChargeType for available values.

trafficPackageSize

No

Float

Data transfer package size (TB).

The unit is TB. The parameter is only required when internetChargeType is ByTrafficPackage.

bandwidth

No

Integer

Outbound public network bandwidth cap (Mbps).

Unit: Mbps.

The value differs with different instance types. See bandwidth configuration for details.

instanceCount

No

Integer

Quantity.

Default value: 1.

systemDisk

Yes

Boot disk.

dataDisk

No

The size of the attached disk.

3. Output Parameters

Parameter Name
Type
Description

specPrice

Price of specifications.

gpuPrice

GPU price.

ipv4Price

IPv4 price.

ipv6Price

IPv6 price.

ipv4BandwidthPrice

Public network IPv4 bandwidth price.

ipv6BandwidthPrice

Public network IPv6 bandwidth price.

systemDiskPrice

Price of the boot disk.

dataDiskPrice

The price of the attached disk.

requestId

String

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

4. Code Example

Query the price of a pay-as-you-go instance with the public network billing method of flat rate.

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

Request:
{
    "zoneId":"SAO-A",
    "instanceType":"c.1c2g",
    "eipV4Type": "xxx",
    "internetChargeType":"ByBandwidth",
    "bandwidth":1,
    "instanceCount": 1,
    "systemDisk":{
        "diskSize":10
    }
}

Response:
{
    "requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
    "response":{
        "requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
        "specPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "gpuPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "ipv4Price": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "ipv6Price": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "ipv4BandwidthPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "ipv6BandwidthPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "systemDiskPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "dataDiskPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        }
    }
}

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 Code
Error Code
Description

404

INVALID_ZONE_NOT_FOUND

Zone does not exist.

404

INVALID_INSTANCE_TYPE_NOT_FOUND

Instance type not found.

400

INVALID_INSTANCE_TYPE_ZONE_NO_SELL

Specified instance specifications not sold in specified availability zone.

400

INVALID_INSTANCE_BANDWIDTH_ZONE_NO_SELL

Specified public network billing model is not supported in the selected availability zone.

400

INVALID_PARAMETER_TRAFFIC_PACKAGE

Invalid data transfer package size.

400

INVALID_PARAMETER_TRAFFIC_PACKAGE_EXCEED

Data package size exceeds the maximum limit.

Last updated