CreatePrePayOrder

更新时间: 2026-03-11 08:05:08

Creates a subscription ApsaraMQ for Kafka instance. Subscription instances require upfront payment and suit long-term, predictable workloads.

Usage notes

  • Review Billing overview before calling this operation to understand subscription pricing.

  • The default subscription duration is one month, with auto-renewal enabled on a one-month cycle. To change the renewal cycle or disable auto-renewal, go to the Renewal page in the Alibaba Cloud console.

  • For ApsaraMQ for Confluent instances, set DeployType to 5 (VPC). After the instance is created, enable or disable individual components as needed.

Debugging

OpenAPI Explorer automatically calculates the signature and generates SDK sample code in multiple languages. Use it to call this operation directly.

Authorization information

The following table shows the authorization information for this operation. Use this information in the Action policy element to grant a RAM user or RAM role the permissions to call this operation.

OperationAccess levelResource typeCondition keyAssociated operation
alikafka:CreatePrePayOrdercreateInstance acs:alikafka:{#regionId}:{#accountId}:instance/*alikafka:SpecType, alikafka:DeployModuleNone

Request parameters

Common parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYesThe ID of the region.cn-hangzhou
DeployTypeintegerYesThe network deployment type. Valid values: 4 (Internet and VPC), 5 (VPC only). Set to 5 for ApsaraMQ for Confluent instances.5
SpecTypestringYesThe instance edition. Valid values for ApsaraMQ for Confluent instances: professional (Professional Edition), enterprise (Enterprise Edition).professional
PaidTypeintegerYesThe billing method. Valid values: 0 (subscription for ApsaraMQ for Kafka), 4 (subscription for ApsaraMQ for Confluent).4
DurationintegerNoThe subscription duration in months. Default: 1. Valid values: 1 and 12 for ApsaraMQ for Confluent; 1 for ApsaraMQ for Kafka.1
ResourceGroupIdstringNoThe ID of the resource group. If not specified, the default resource group is used. Get the ID from the Resource Group page in the Resource Management console.rg-ac\*\*\*\*\*\*\*\*\*\*\*7q

Tag

ParameterTypeRequiredDescriptionExample
KeystringYesThe tag key. Maximum length: 128 characters. Cannot contain http:// or https://, or start with acs: or aliyun. If not specified, all tag keys are matched.FinanceDept
ValuestringNoThe tag value. Maximum length: 128 characters. Cannot contain http:// or https://, or start with acs: or aliyun.FinanceJoshua

ConfluentConfig

All parameters in this object are required when creating an ApsaraMQ for Confluent instance.

Kafka broker

ParameterTypeDescriptionExample
KafkaCUintegerThe number of CPU cores.4
KafkaStorageintegerThe disk capacity in GB.800
KafkaReplicaintegerThe number of replicas.3

ZooKeeper

ParameterTypeDescriptionExample
ZooKeeperCUintegerThe number of CPU cores.2
ZooKeeperStorageintegerThe disk capacity in GB.100
ZooKeeperReplicaintegerThe number of replicas.3

Control Center

ParameterTypeDescriptionExample
ControlCenterCUintegerThe number of CPU cores.4
ControlCenterStorageintegerThe disk capacity in GB.300
ControlCenterReplicaintegerThe number of replicas.1

Schema Registry

ParameterTypeDescriptionExample
SchemaRegistryCUintegerThe number of CPU cores.1
SchemaRegistryReplicaintegerThe number of replicas.2

Connect

ParameterTypeDescriptionExample
ConnectCUintegerThe number of CPU cores.4
ConnectReplicaintegerThe number of replicas.2

ksqlDB

ParameterTypeDescriptionExample
KsqlCUintegerThe number of CPU cores.4
KsqlStorageintegerThe disk capacity in GB.100
KsqlReplicaintegerThe number of replicas.2

Kafka REST Proxy

ParameterTypeDescriptionExample
KafkaRestProxyCUintegerThe number of CPU cores.4
KafkaRestProxyReplicaintegerThe number of replicas.2

Response parameters

ParameterTypeDescriptionExample
CodeintegerThe response code. 200 indicates success.200
MessagestringThe response message.operation success.
RequestIdstringThe request ID.06084011-E093-46F3-A51F-4B19A8AD\*\*\*\*
SuccessbooleanIndicates whether the request succeeded.true
OrderIdstringThe order ID.20497346575\*\*\*\*

Examples

Sample request (Python)

The following example creates a Professional Edition ApsaraMQ for Confluent instance in the China (Hangzhou) region. For SDK samples in other languages, use OpenAPI Explorer.

import os
from alibabacloud_alikafka20190916.client import Client
from alibabacloud_alikafka20190916.models import (
    CreatePrePayOrderRequest,
    CreatePrePayOrderRequestConfluentConfig,
)
from alibabacloud_tea_openapi.models import Config

# Get credentials from environment variables
config = Config(
    access_key_id=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_ID"),
    access_key_secret=os.environ.get("ALIBABA_CLOUD_ACCESS_KEY_SECRET"),
    endpoint="alikafka.<region-id>.aliyuncs.com",  # Replace <region-id>, e.g., cn-hangzhou
)

client = Client(config)

confluent_config = CreatePrePayOrderRequestConfluentConfig(
    kafka_cu=4,
    kafka_storage=800,
    kafka_replica=3,
    zoo_keeper_cu=2,
    zoo_keeper_storage=100,
    zoo_keeper_replica=3,
    control_center_cu=4,
    control_center_storage=300,
    control_center_replica=1,
    schema_registry_cu=1,
    schema_registry_replica=2,
    connect_cu=4,
    connect_replica=2,
    ksql_cu=4,
    ksql_storage=100,
    ksql_replica=2,
    kafka_rest_proxy_cu=4,
    kafka_rest_proxy_replica=2,
)

request = CreatePrePayOrderRequest(
    region_id="cn-hangzhou",
    deploy_type=5,
    spec_type="professional",
    paid_type=4,
    confluent_config=confluent_config,
)

response = client.create_pre_pay_order(request)
print(f"Order ID: {response.body.order_id}")

Replace the following placeholder with your actual value:

PlaceholderDescriptionExample
<region-id>The region ID for the endpointcn-hangzhou

Sample response

{
  "Code": 200,
  "Message": "operation success.",
  "RequestId": "06084011-E093-46F3-A51F-4B19A8AD****",
  "Success": true,
  "OrderId": "20497346575****"
}

Error codes

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

Change history

Effective dateChangeDetails
2024-05-08Error codes modified.

View change details

2024-04-17Error codes modified.

View change details

2024-04-16Error codes modified.

View change details

2024-04-11Error codes modified.

View change details

2024-03-20Error codes and input parameters modified.

View change details

2024-03-20Error codes and input parameters modified.

View change details

2024-03-01Error codes modified.

View change details

2024-02-27Error codes and input parameters modified.

View change details

2022-10-28Error codes and input parameters modified.

View change details

2022-08-31Error codes modified.

View change details

上一篇: Instances 下一篇: StartInstance - Deploy an instance
阿里云首页 云消息队列 Kafka 版 相关技术圈