CreatePrePayOrder
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
DeployTypeto5(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.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| alikafka:CreatePrePayOrder | create | Instance acs:alikafka:{#regionId}:{#accountId}:instance/* | alikafka:SpecType, alikafka:DeployModule | None |
Request parameters
Common parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| RegionId | string | Yes | The ID of the region. | cn-hangzhou |
| DeployType | integer | Yes | The network deployment type. Valid values: 4 (Internet and VPC), 5 (VPC only). Set to 5 for ApsaraMQ for Confluent instances. | 5 |
| SpecType | string | Yes | The instance edition. Valid values for ApsaraMQ for Confluent instances: professional (Professional Edition), enterprise (Enterprise Edition). | professional |
| PaidType | integer | Yes | The billing method. Valid values: 0 (subscription for ApsaraMQ for Kafka), 4 (subscription for ApsaraMQ for Confluent). | 4 |
| Duration | integer | No | The subscription duration in months. Default: 1. Valid values: 1 and 12 for ApsaraMQ for Confluent; 1 for ApsaraMQ for Kafka. | 1 |
| ResourceGroupId | string | No | The 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
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| Key | string | Yes | The 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 |
| Value | string | No | The 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
| Parameter | Type | Description | Example |
|---|---|---|---|
| KafkaCU | integer | The number of CPU cores. | 4 |
| KafkaStorage | integer | The disk capacity in GB. | 800 |
| KafkaReplica | integer | The number of replicas. | 3 |
ZooKeeper
| Parameter | Type | Description | Example |
|---|---|---|---|
| ZooKeeperCU | integer | The number of CPU cores. | 2 |
| ZooKeeperStorage | integer | The disk capacity in GB. | 100 |
| ZooKeeperReplica | integer | The number of replicas. | 3 |
Control Center
| Parameter | Type | Description | Example |
|---|---|---|---|
| ControlCenterCU | integer | The number of CPU cores. | 4 |
| ControlCenterStorage | integer | The disk capacity in GB. | 300 |
| ControlCenterReplica | integer | The number of replicas. | 1 |
Schema Registry
| Parameter | Type | Description | Example |
|---|---|---|---|
| SchemaRegistryCU | integer | The number of CPU cores. | 1 |
| SchemaRegistryReplica | integer | The number of replicas. | 2 |
Connect
| Parameter | Type | Description | Example |
|---|---|---|---|
| ConnectCU | integer | The number of CPU cores. | 4 |
| ConnectReplica | integer | The number of replicas. | 2 |
ksqlDB
| Parameter | Type | Description | Example |
|---|---|---|---|
| KsqlCU | integer | The number of CPU cores. | 4 |
| KsqlStorage | integer | The disk capacity in GB. | 100 |
| KsqlReplica | integer | The number of replicas. | 2 |
Kafka REST Proxy
| Parameter | Type | Description | Example |
|---|---|---|---|
| KafkaRestProxyCU | integer | The number of CPU cores. | 4 |
| KafkaRestProxyReplica | integer | The number of replicas. | 2 |
Response parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| Code | integer | The response code. 200 indicates success. | 200 |
| Message | string | The response message. | operation success. |
| RequestId | string | The request ID. | 06084011-E093-46F3-A51F-4B19A8AD\*\*\*\* |
| Success | boolean | Indicates whether the request succeeded. | true |
| OrderId | string | The 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:
| Placeholder | Description | Example |
|---|---|---|
<region-id> | The region ID for the endpoint | cn-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 date | Change | Details |
|---|---|---|
| 2024-05-08 | Error codes modified. | |
| 2024-04-17 | Error codes modified. | |
| 2024-04-16 | Error codes modified. | |
| 2024-04-11 | Error codes modified. | |
| 2024-03-20 | Error codes and input parameters modified. | |
| 2024-03-20 | Error codes and input parameters modified. | |
| 2024-03-01 | Error codes modified. | |
| 2024-02-27 | Error codes and input parameters modified. | |
| 2022-10-28 | Error codes and input parameters modified. | |
| 2022-08-31 | Error codes modified. |