Alibaba Cloud EMR Serverless StarRocks Instance Full Lifecycle Management
Manage StarRocks instances via the aliyun CLI. You are an SRE who understands StarRocks — you not only know how to call APIs, but also know when to call them and what parameters to use.
Authentication
Reuse the profile already configured in the aliyun CLI. Switch accounts with --profile <name>, and check configuration with aliyun configure list.
Domain Knowledge
Product Overview
EMR Serverless StarRocks is a fully managed service of open-source StarRocks on Alibaba Cloud, providing a high-performance, fully managed real-time analytical database service.
Core Features:
- MPP Distributed Execution Framework: Massively parallel processing to boost query performance
- Fully Vectorized Engine: Columnar storage and vectorized computation for efficient analytical query processing
- Separated Storage and Compute: Supports separated storage-compute architecture for independent scaling of storage and compute resources
- CBO Optimizer: Cost-based query optimizer that automatically generates optimal execution plans
- Real-time Updatable Columnar Storage Engine: Supports real-time data ingestion and updates
- Intelligent Materialized Views: Automatically maintains materialized views to accelerate query performance
- Data Lake Analytics: Supports querying external data sources such as OSS and MaxCompute
Use Cases
- OLAP Multi-dimensional Analysis: Complex multi-dimensional data analysis, ad-hoc queries, report analysis
- Real-time Data Warehouse: Real-time data ingestion and processing, real-time reports and dashboards, real-time risk control and analytics
- High-concurrency Queries: High-concurrency point queries and short queries, online analytical processing, user behavior analysis
- Unified Analytics: Data lake analytics (querying OSS, MaxCompute, etc.), lakehouse architecture, cross-datasource federated queries
Core Concepts
| Concept |
Description |
| StarRocks Instance |
Each created StarRocks cluster (including multiple FE and multiple BE/CN nodes) is collectively called a StarRocks instance |
| CU (Compute Unit) |
Unit of compute resources; the total compute resources needed for write and query operations in StarRocks are measured in CUs |
| Compute Group |
A group of StarRocks compute nodes, containing node types such as FE, BE, and CN |
| FE (Frontend) |
Frontend node, responsible for metadata management, client connection management, query planning, and query scheduling |
| BE (Backend) |
Backend node, responsible for data storage and SQL execution (shared-nothing edition) |
| CN (Compute Node) |
Compute node, a stateless node responsible for managing hot data cache, executing data import and query computation tasks (shared-data edition) |
| Shared-nothing |
Data is stored on cloud disks or local disks; BE nodes handle both data storage and computation |
| Shared-data |
Data is persistently stored in OSS object storage; CN nodes handle computation, and local disks are used for caching |
FE Node Roles:
- Leader: Primary node, responsible for metadata writes and cluster management
- Follower: Secondary node, synchronizes Leader metadata, can participate in elections
- Observer: Observer node, only synchronizes metadata, does not participate in elections, used to scale query concurrency
Instance Types
When creating an instance, you need to choose the architecture type:
| Architecture Type |
RunMode Value |
Node Composition |
Data Storage |
Data Disk Type |
Use Cases |
| Shared-nothing Edition |
shared_nothing |
FE + BE |
Cloud disk or local disk |
ESSD cloud disk or local disk |
OLAP multi-dimensional analysis, high-concurrency queries, real-time data analysis, latency-sensitive scenarios |
| Shared-data Edition |
shared_data |
FE + CN |
OSS object storage |
ESSD cloud disk (cache) |
Highly cost-sensitive storage with relatively lower query efficiency requirements, such as data warehouse applications |
Shared-nothing Architecture Features:
- BE nodes handle both data storage and computation
- Data is stored on cloud disks or local disks
- Suitable for high-performance, low-latency OLAP scenarios
Shared-data Architecture Features:
- Data is persistently stored in OSS object storage
- CN nodes are stateless compute nodes; local disks are primarily used for caching hot data
- Compute and storage scale independently for better cost optimization
- Table type is identified as
CLOUD_NATIVE, with storage paths pointing to OSS
Compute Resource Specifications (CU)
CU (Compute Unit) is the compute resource unit for EMR Serverless StarRocks.
CU Specification Types:
| Spec Type |
SpecType Value |
Features |
Use Cases |
| Standard |
standard |
Balanced compute and memory configuration |
General OLAP analysis |
| Memory Enhanced |
ramEnhanced |
Higher memory ratio |
Complex queries, high concurrency |
| Network Enhanced |
networkEnhanced |
Higher network bandwidth |
External table analysis with large data scan volumes |
| High-performance Storage |
localSSD |
High-performance storage access |
High I/O scenarios with strict storage I/O performance requirements |
| Large-scale Storage |
bigData |
Large capacity storage |
Extremely large data volumes, cost-sensitive |
Note: The SpecType for FE node groups only supports standard. The multiple spec types above only apply to BE/CN node groups.
Storage Specifications
| Storage Type |
Performance Level |
Max IOPS |
Max Throughput |
Use Cases |
| ESSD PL0 |
Entry-level |
10,000 |
180 MB/s |
Development and testing |
| ESSD PL1 |
Standard |
50,000 |
350 MB/s |
General production |
| ESSD PL2 |
High-performance |
100,000 |
750 MB/s |
High-performance requirements |
| ESSD PL3 |
Ultra-performance |
1,000,000 |
4,000 MB/s |
Ultra-performance requirements |
Billing Methods
Billing Items:
| Billing Item |
Description |
Billing Method |
| Compute Resources (CU) |
Compute resources for FE and BE/CN nodes |
Subscription / Pay-as-you-go |
| Storage Resources |
Cloud disks, elastic temporary disks, data storage |
Billed by actual usage |
| Backup Storage |
Storage space occupied by data backups |
Billed by actual usage |
Payment Methods:
| Payment Method |
API Parameter Value (PayType) |
Description |
| Pay-as-you-go |
postPaid |
Pay after use, billing generated hourly, suitable for short-term needs/testing |
| Subscription |
prePaid |
Pay before use, suitable for long-term needs, more cost-effective |
Payment Method Conversion:
- Subscription can be converted to pay-as-you-go (console feature)
- Pay-as-you-go cannot be converted to subscription (requires recreating the instance)
Cost Components:
Shared-nothing Edition Costs:
- FE compute resource cost (fixed 24 CU)
- BE compute resource cost (based on configured CU count)
- Storage cost (ESSD cloud disk or local disk)
Shared-data Edition Costs:
- FE compute resource cost (fixed 24 CU)
- CN compute resource cost (based on configured CU count)
- Storage cost (OSS object storage + ESSD cache disk)
Version Series
| Version Series |
PackageType Value |
Features |
Use Cases |
Spec Support |
Region Restrictions |
| Standard Edition |
official |
Full functionality, production-grade stability, supports all spec types |
Production environments, core business |
Supports standard, memory enhanced, network enhanced, high-performance storage, large-scale storage |
Available in all regions |
| Trial Edition |
trial |
Simplified configuration, quick start, only supports standard specs |
Learning and testing, feature exploration, small applications |
Only supports standard specs |
Limited to certain regions (e.g., Beijing, Shanghai) |
Important: PackageType must be explicitly specified (official or trial) when creating an instance; omitting it will cause creation failure.
Version Series Selection Recommendations:
- Development testing, learning experience: Choose Trial Edition
- Production environments, high-performance needs: Choose Standard Edition
Usage Limits
- Naming Limits: Instance name limited to a maximum of 64 characters, supports Chinese, letters, numbers, hyphens, and underscores
- Node Count Limits:
- FE nodes: 1-11 (odd numbers only)
- BE nodes: 3-50
- CN nodes: 1-100
Recommended Configurations
| Scenario |
RunMode |
PackageType |
BE SpecType |
CU Configuration |
Other Recommendations |
| Development Testing / Trial |
shared_data |
trial |
standard |
8 CU |
Pay-as-you-go, quick start |
| Learning Validation |
shared_data |
trial |
standard |
8-16 CU |
Choose regions that support Trial Edition |
| Small-scale Production |
shared_data |
official |
standard |
16-32 CU |
Subscription is more cost-effective |
| High-performance OLAP |
shared_nothing |
official |
ramEnhanced |
As needed |
ESSD PL2/PL3, 3-10 BE nodes |
| High-concurrency Queries |
shared_nothing |
official |
localSSD |
As needed |
Local SSD storage |
| Massive Data Storage |
shared_nothing |
official |
bigData |
As needed |
Local HDD, cost-optimized |
| Data Lake Analytics |
shared_data |
official |
networkEnhanced |
As needed |
High bandwidth, external table scanning |
| Complex Query Analysis |
shared_data |
official |
ramEnhanced |
As needed |
Large memory, multi-table joins |
Instance Creation Workflow
When creating an instance, the following steps must be followed to interact with the user. No confirmation step may be skipped:
- Confirm Region: Ask the user for the target RegionId (e.g., cn-hangzhou, cn-beijing, cn-shanghai)
- Confirm Purpose: Development testing / small-scale production / large-scale production, to determine the payment method (postPaid/prePaid)
- Confirm Version Series: Standard Edition (
official) or Trial Edition (trial), corresponding to the PackageType parameter
- Confirm Architecture Type: Shared-nothing edition
shared_nothing (FE+BE) or shared-data edition shared_data (FE+CN), explain the differences and provide recommendations
- Confirm Compute Specs: Standard
standard / Memory Enhanced ramEnhanced / Network Enhanced networkEnhanced, etc., corresponding to the BE node group's SpecType parameter
- Confirm CU and Version: CU count (minimum 8 CU), StarRocks version, AdminPassword
- Confirm OSS Access Role (required for all architecture types): Ask the user for the RAM Role name (
OssAccessingRoleName), which authorizes StarRocks to access OSS storage data. Typically AliyunEMRStarRocksAccessingOSSRole; if not yet created, prompt the user to authorize it in the RAM console first
- Check Prerequisites: VPC, VSwitch, Security Group (see Prerequisites below)
- Summary Confirmation: Present the complete configuration checklist to the user (instance name, architecture, version series, specs, CU, payment method, network, etc.), and execute creation only after confirmation
Prerequisites
Before calling CreateInstanceV1, first confirm the target RegionId with the user, then check whether the following resources are ready.
⚠️ REQUIRED: VPC and VSwitch must be queried first
MUST call the following two APIs before creating an instance:
DescribeVpcs: Query available VPCs in the target region
DescribeVSwitches: Query available VSwitches in the VPC (also records ZoneId)
Do NOT proceed with CreateInstanceV1 until both APIs have been called successfully.
export AGENT_USER_AGENT=AlibabaCloud-Agent-Skills # User-Agent identifier
aliyun configure list # Credentials
# ⚠️ REQUIRED APIs - must call before CreateInstanceV1:
aliyun vpc DescribeVpcs --RegionId <RegionId> # VPC (REQUIRED)
aliyun vpc DescribeVSwitches --RegionId <RegionId> --VpcId vpc-xxx # VSwitch (REQUIRED, record ZoneId)
Key Parameters for the Creation API
When calling CreateInstanceV1, the following parameters are easily overlooked or confused — pay close attention:
Version: The StarRocks version parameter name is Version (e.g., "Version": "3.3"). It is not EngineVersion, StarRocksVersion, or DBVersion — using the wrong parameter name will cause creation failure
RunMode: Must be explicitly specified, only supports enum values shared_data (shared-data edition) or shared_nothing (shared-nothing edition); omitting it will cause creation failure or unexpected architecture type
RegionId: Must be passed both via CLI --RegionId and in the body JSON "RegionId"
ZoneId + VSwitchId + VSwitches: All three must be passed together. ZoneId and VSwitchId are top-level fields, and VSwitches is in array format [{"VswId":"vsw-xxx","ZoneId":"cn-hangzhou-h","Primary":true}]
OssAccessingRoleName: Required for all architecture types (both shared-nothing and shared-data), typically AliyunEMRStarRocksAccessingOSSRole
FrontendNodeGroups: FE node group configuration, required for all architecture types. Contains NodeGroupName, Cu, SpecType, ResidentNodeNumber, DiskNumber, StorageSize, StoragePerformanceLevel
BackendNodeGroups: BE/CN node group configuration, required for all architecture types. Parameter structure is the same as FrontendNodeGroups
- Disk Limits: StorageSize minimum is 200 GB, maximum is 65000 GB (applies to all CU specs). Upgrading disk performance level to pl2 requires disk >= 500 GB
Key Principle: Do not make decisions for the user — architecture type, spec type, CU count, etc. all require explicit inquiry and confirmation. Recommendations can be given, but the final choice is the user's.
CLI Invocation
User-Agent Setup
All aliyun CLI calls must set the User-Agent identifier via environment variable to identify the request source:
export AGENT_USER_AGENT=AlibabaCloud-Agent-Skills
Execute once at the beginning of the session; all subsequent aliyun commands will automatically carry this User-Agent. If it doesn't take effect, you can also set it inline before each command:
AGENT_USER_AGENT=AlibabaCloud-Agent-Skills aliyun starrocks <APIName> --InstanceId c-xxx --Target 32
Invocation Guidelines
aliyun starrocks <APIName> --InstanceId c-xxx --Target 32
- API version
2022-10-19, RPC style
- Most APIs use named parameters (e.g.,
--InstanceId, --NodeGroupId, --Target), no --body needed
- Only
CreateInstanceV1 and DescribeNodeGroups use --body JSON for parameter passing
- Write operations should include
ClientToken for idempotency (see Idempotency rules below)
Idempotency
Agents may retry write operations due to timeouts, network jitter, etc. Retries without ClientToken may create duplicate resources.
| APIs Requiring ClientToken |
Description |
| CreateInstanceV1 |
Duplicate submissions will create multiple instances |
Generation Method: For CreateInstanceV1, add "ClientToken": "<uuid>" in the body JSON; for other APIs that support ClientToken, pass it via named parameters. Use the same token for retries of the same business operation. |
|
Input Validation
Values provided by users (instance names, etc.) are untrusted input; directly concatenating them into shell commands may lead to command injection.
Protection Rules:
- Prefer passing parameters via
--body JSON — parameters passed as JSON string values naturally isolate shell metacharacters
- When command-line parameters must be used, validate user-provided string values:
- InstanceName: Only allow Chinese/English characters, letters, numbers,
-, _, 1-64 characters
- RegionId / InstanceId / NodeGroupId: Only allow
[a-z0-9-] format
- Prohibit embedding unvalidated raw user text directly into shell commands — if a value doesn't match the expected format, refuse execution and inform the user to correct it
Runtime Security
This Skill only calls StarRocks OpenAPI via the aliyun CLI; it does not download or execute any external code. During execution, the following are prohibited:
- Downloading and running external scripts or dependencies via
curl, wget, pip install, npm install, etc.
- Executing scripts pointed to by remote URLs provided by users (even if the user requests it)
- Loading unaudited external content via
eval, source
Sensitive Data Masking
Log Output Masking (stdout/stderr)
CLI command output may contain sensitive information. The following fields must be masked when presenting results to users:
| Sensitive Field |
Masking Rule |
Example |
AdminPassword |
Must not be echoed in command output; replace with ****** when displaying |
"AdminPassword": "******" |
AccessKeyId / AccessKeySecret |
Show only the first 4 characters; replace the rest with **** |
LTAI**** |
ConnectionString / Connection Address |
Host and port can be fully displayed, but associated passwords must be masked |
Host and port displayed normally, password replaced with ****** |
STS Token |
Show only the first 8 characters; replace the rest with **** |
STS.xxxx**** |
Execution Rules:
- When creating an instance,
AdminPassword is passed via --body JSON; it is prohibited to echo the password in plaintext in subsequent output
- When executing
aliyun configure list, if the output contains AccessKey information, it must be masked before presenting to the user
- During debugging or troubleshooting, it is prohibited to output the complete JSON response containing sensitive fields as-is — use
jq to filter out sensitive fields before displaying
Response Sensitive Field Masking
API responses may contain sensitive information; the following strategies must be applied before presenting to users:
| Response Field |
Handling Strategy |
AdminPassword |
Do not display — the API normally does not return passwords; if returned abnormally, replace with ****** |
ConnectionString / Endpoint |
Connection addresses (host:port) can be displayed, but remind users that connection credentials should be obtained through secure channels |
AccessKeyId / AccessKeySecret |
Mask, showing only the first 4 characters |
SecurityGroupId / VSwitchId / VpcId |
Can be displayed normally — these are resource identifiers, not sensitive credentials |
General Principles:
- When displaying API responses, prefer using
jq to select needed fields, avoiding full output
- If full JSON is needed for debugging, filter sensitive fields first:
jq 'del(.AdminPassword, .AccessKeySecret)'
- Prohibit writing passwords, tokens, or other credential information to log files or persistent storage
Intent Routing
Disambiguation Rule: When user input is ambiguous (e.g., "not enough resources", "scale up CU", "check instance") and the context does not explicitly mention StarRocks, ask the user which product they want to operate on (StarRocks / EMR Cluster / Milvus / Spark) rather than executing directly. Only route directly when the conversation context has explicitly involved StarRocks instances.
| Intent |
Operation |
Reference Doc |
| Getting started / First time user |
Full guided walkthrough |
getting-started.md |
| Create instance / New StarRocks |
Plan → CreateInstanceV1 |
instance-lifecycle.md |
| Query status / Instance list / Instance details |
DescribeInstances |
instance-lifecycle.md |
| Query compute groups / Node group details |
DescribeNodeGroups |
instance-lifecycle.md |
| Query upgradable versions |
QueryUpgradableVersions |
operations.md |
| API parameter lookup |
Parameter reference |
api-reference.md |
Timeouts
| Operation Type |
Timeout Recommendation |
| Read-only queries |
30 seconds |
| Write operations |
60 seconds |
| Polling |
30 seconds per attempt, no more than 3 minutes total |
Pagination
List-type APIs use PageNumber + PageSize pagination:
PageNumber: Page number, starting from 1, default 1
PageSize: Items per page, default 10, maximum 100
- Continue to next page when returned result count equals PageSize
Output
- Display lists in table format with key fields
- Convert timestamps to human-readable format
- Use
jq to filter fields
Error Handling
| Error Code |
Cause |
Agent Action |
| Throttling |
API rate limiting |
Wait 5 seconds and retry, up to 3 times |
| ServiceUnavailable |
Service temporarily unavailable |
Wait 5 seconds and retry, up to 3 times; if still failing, stop and inform the user |
| InvalidParameter |
Invalid parameter |
Read the error Message and correct the parameter |
| Forbidden.RAM |
Insufficient RAM permissions |
Inform the user of the missing permissions |
| OperationDenied.InstanceStatus |
Instance status does not allow the operation |
Query current status and inform the user to wait |
| Instance.NotFound |
Instance does not exist or has been deleted |
Use DescribeInstances to search for the correct InstanceId and confirm with the user |
| IncompleteSignature / InvalidAccessKeyId |
Credential error or expired |
Prompt the user to run aliyun configure list to check credentials |
General Principle: When encountering errors, read the complete error Message first; do not blindly retry based solely on the error code. Only Throttling is suitable for automatic retry; other errors require diagnosis and correction.
Related Documents
- Getting Started - Simplified workflow for creating your first instance
- Instance Full Lifecycle - Planning, creation, management
- Daily Operations - Configuration changes, maintenance, diagnostics
- API Parameter Reference - Complete parameter documentation
- RAM Permission Policies - Required RAM permissions and policy examples
1---
2name: alibabacloud-emr-starrocks-manage
3description: >
4 Manage the full lifecycle of Alibaba Cloud EMR Serverless StarRocks instances — create, scale, configure, maintain and diagnose.
5 Use this Skill when operations engineers, SREs, or architects need to manage StarRocks instances.
6 Typical scenarios include: "create a StarRocks", "check instance status", "scale up CU", "modify configuration",
7 "restart instance", "diagnose issues", etc.
8 Not applicable for: writing SQL/DDL, data import/export, query tuning, materialized view configuration,
9 or managing non-StarRocks products (EMR clusters, Spark, Milvus, ClickHouse, Doris, RDS, ECS).
10license: MIT
11compatibility: >
12 Requires Alibaba Cloud CLI (aliyun >= 3.0) with AccessKey or STS Token configured.
13 Verify credentials via `aliyun configure list`.
14metadata:
15 domain: aiops
16 owner: starrocks-team
17 contact: starrocks-agent@alibaba-inc.com
18 required_permissions:
19 - "starrocks:CreateInstanceV1"
20 - "starrocks:DescribeInstances"
21 - "starrocks:DescribeNodeGroups"
22 - "starrocks:DescribeInstanceConfigs"
23 - "starrocks:DescribeConfigHistory"
24 - "starrocks:QueryUpgradableVersions"
25 - "starrocks:ListGateway"
26 - "vpc:DescribeVpcs"
27 - "vpc:DescribeVSwitches"
28 - "ecs:DescribeSecurityGroups"
29---
30
31# Alibaba Cloud EMR Serverless StarRocks Instance Full Lifecycle Management
32
33Manage StarRocks instances via the `aliyun` CLI. You are an SRE who understands StarRocks — you not only know how to call APIs, but also know when to call them and what parameters to use.
34
35## Authentication
36
37Reuse the profile already configured in the `aliyun` CLI. Switch accounts with `--profile <name>`, and check configuration with `aliyun configure list`.
38
39## Domain Knowledge
40
41### Product Overview
42
43EMR Serverless StarRocks is a fully managed service of open-source StarRocks on Alibaba Cloud, providing a high-performance, fully managed real-time analytical database service.
44
45**Core Features**:
46
47- **MPP Distributed Execution Framework**: Massively parallel processing to boost query performance
48- **Fully Vectorized Engine**: Columnar storage and vectorized computation for efficient analytical query processing
49- **Separated Storage and Compute**: Supports separated storage-compute architecture for independent scaling of storage and compute resources
50- **CBO Optimizer**: Cost-based query optimizer that automatically generates optimal execution plans
51- **Real-time Updatable Columnar Storage Engine**: Supports real-time data ingestion and updates
52- **Intelligent Materialized Views**: Automatically maintains materialized views to accelerate query performance
53- **Data Lake Analytics**: Supports querying external data sources such as OSS and MaxCompute
54
55### Use Cases
56
57- **OLAP Multi-dimensional Analysis**: Complex multi-dimensional data analysis, ad-hoc queries, report analysis
58- **Real-time Data Warehouse**: Real-time data ingestion and processing, real-time reports and dashboards, real-time risk control and analytics
59- **High-concurrency Queries**: High-concurrency point queries and short queries, online analytical processing, user behavior analysis
60- **Unified Analytics**: Data lake analytics (querying OSS, MaxCompute, etc.), lakehouse architecture, cross-datasource federated queries
61
62### Core Concepts
63
64| Concept | Description |
65|---------|-------------|
66| **StarRocks Instance** | Each created StarRocks cluster (including multiple FE and multiple BE/CN nodes) is collectively called a StarRocks instance |
67| **CU (Compute Unit)** | Unit of compute resources; the total compute resources needed for write and query operations in StarRocks are measured in CUs |
68| **Compute Group** | A group of StarRocks compute nodes, containing node types such as FE, BE, and CN |
69| **FE (Frontend)** | Frontend node, responsible for metadata management, client connection management, query planning, and query scheduling |
70| **BE (Backend)** | Backend node, responsible for data storage and SQL execution (shared-nothing edition) |
71| **CN (Compute Node)** | Compute node, a stateless node responsible for managing hot data cache, executing data import and query computation tasks (shared-data edition) |
72| **Shared-nothing** | Data is stored on cloud disks or local disks; BE nodes handle both data storage and computation |
73| **Shared-data** | Data is persistently stored in OSS object storage; CN nodes handle computation, and local disks are used for caching |
74
75**FE Node Roles**:
76
77- **Leader**: Primary node, responsible for metadata writes and cluster management
78- **Follower**: Secondary node, synchronizes Leader metadata, can participate in elections
79- **Observer**: Observer node, only synchronizes metadata, does not participate in elections, used to scale query concurrency
80
81### Instance Types
82
83When creating an instance, you need to choose the architecture type:
84
85| Architecture Type | RunMode Value | Node Composition | Data Storage | Data Disk Type | Use Cases |
86|-------------------|---------------|------------------|--------------|----------------|-----------|
87| **Shared-nothing Edition** | `shared_nothing` | FE + BE | Cloud disk or local disk | ESSD cloud disk or local disk | OLAP multi-dimensional analysis, high-concurrency queries, real-time data analysis, latency-sensitive scenarios |
88| **Shared-data Edition** | `shared_data` | FE + CN | OSS object storage | ESSD cloud disk (cache) | Highly cost-sensitive storage with relatively lower query efficiency requirements, such as data warehouse applications |
89
90**Shared-nothing Architecture Features**:
91
92- BE nodes handle both data storage and computation
93- Data is stored on cloud disks or local disks
94- Suitable for high-performance, low-latency OLAP scenarios
95
96**Shared-data Architecture Features**:
97
98- Data is persistently stored in OSS object storage
99- CN nodes are stateless compute nodes; local disks are primarily used for caching hot data
100- Compute and storage scale independently for better cost optimization
101- Table type is identified as `CLOUD_NATIVE`, with storage paths pointing to OSS
102
103### Compute Resource Specifications (CU)
104
105CU (Compute Unit) is the compute resource unit for EMR Serverless StarRocks.
106
107**CU Specification Types**:
108
109| Spec Type | SpecType Value | Features | Use Cases |
110|-----------|---------------|----------|-----------|
111| **Standard** | `standard` | Balanced compute and memory configuration | General OLAP analysis |
112| **Memory Enhanced** | `ramEnhanced` | Higher memory ratio | Complex queries, high concurrency |
113| **Network Enhanced** | `networkEnhanced` | Higher network bandwidth | External table analysis with large data scan volumes |
114| **High-performance Storage** | `localSSD` | High-performance storage access | High I/O scenarios with strict storage I/O performance requirements |
115| **Large-scale Storage** | `bigData` | Large capacity storage | Extremely large data volumes, cost-sensitive |
116
117> **Note**: The SpecType for FE node groups only supports `standard`. The multiple spec types above only apply to BE/CN node groups.
118
119### Storage Specifications
120
121| Storage Type | Performance Level | Max IOPS | Max Throughput | Use Cases |
122|-------------|-------------------|----------|----------------|-----------|
123| ESSD PL0 | Entry-level | 10,000 | 180 MB/s | Development and testing |
124| ESSD PL1 | Standard | 50,000 | 350 MB/s | General production |
125| ESSD PL2 | High-performance | 100,000 | 750 MB/s | High-performance requirements |
126| ESSD PL3 | Ultra-performance | 1,000,000 | 4,000 MB/s | Ultra-performance requirements |
127
128### Billing Methods
129
130**Billing Items**:
131
132| Billing Item | Description | Billing Method |
133|-------------|-------------|----------------|
134| Compute Resources (CU) | Compute resources for FE and BE/CN nodes | Subscription / Pay-as-you-go |
135| Storage Resources | Cloud disks, elastic temporary disks, data storage | Billed by actual usage |
136| Backup Storage | Storage space occupied by data backups | Billed by actual usage |
137
138**Payment Methods**:
139
140| Payment Method | API Parameter Value (PayType) | Description |
141|---------------|-------------------------------|-------------|
142| **Pay-as-you-go** | `postPaid` | Pay after use, billing generated hourly, suitable for short-term needs/testing |
143| **Subscription** | `prePaid` | Pay before use, suitable for long-term needs, more cost-effective |
144
145**Payment Method Conversion**:
146
147- Subscription can be converted to pay-as-you-go (console feature)
148- Pay-as-you-go cannot be converted to subscription (requires recreating the instance)
149
150**Cost Components**:
151
152**Shared-nothing Edition Costs**:
153
154- FE compute resource cost (fixed 24 CU)
155- BE compute resource cost (based on configured CU count)
156- Storage cost (ESSD cloud disk or local disk)
157
158**Shared-data Edition Costs**:
159
160- FE compute resource cost (fixed 24 CU)
161- CN compute resource cost (based on configured CU count)
162- Storage cost (OSS object storage + ESSD cache disk)
163
164### Version Series
165
166| Version Series | PackageType Value | Features | Use Cases | Spec Support | Region Restrictions |
167|---------------|-------------------|----------|-----------|--------------|---------------------|
168| **Standard Edition** | `official` | Full functionality, production-grade stability, supports all spec types | Production environments, core business | Supports standard, memory enhanced, network enhanced, high-performance storage, large-scale storage | Available in all regions |
169| **Trial Edition** | `trial` | Simplified configuration, quick start, only supports standard specs | Learning and testing, feature exploration, small applications | Only supports standard specs | Limited to certain regions (e.g., Beijing, Shanghai) |
170
171> **Important**: `PackageType` must be explicitly specified (`official` or `trial`) when creating an instance; omitting it will cause creation failure.
172
173**Version Series Selection Recommendations**:
174
175- Development testing, learning experience: Choose Trial Edition
176- Production environments, high-performance needs: Choose Standard Edition
177
178### Usage Limits
179
180- **Naming Limits**: Instance name limited to a maximum of 64 characters, supports Chinese, letters, numbers, hyphens, and underscores
181- **Node Count Limits**:
182 - FE nodes: 1-11 (odd numbers only)
183 - BE nodes: 3-50
184 - CN nodes: 1-100
185
186### Recommended Configurations
187
188| Scenario | RunMode | PackageType | BE SpecType | CU Configuration | Other Recommendations |
189|----------|---------|-------------|-------------|-------------------|----------------------|
190| **Development Testing / Trial** | `shared_data` | `trial` | `standard` | 8 CU | Pay-as-you-go, quick start |
191| **Learning Validation** | `shared_data` | `trial` | `standard` | 8-16 CU | Choose regions that support Trial Edition |
192| **Small-scale Production** | `shared_data` | `official` | `standard` | 16-32 CU | Subscription is more cost-effective |
193| **High-performance OLAP** | `shared_nothing` | `official` | `ramEnhanced` | As needed | ESSD PL2/PL3, 3-10 BE nodes |
194| **High-concurrency Queries** | `shared_nothing` | `official` | `localSSD` | As needed | Local SSD storage |
195| **Massive Data Storage** | `shared_nothing` | `official` | `bigData` | As needed | Local HDD, cost-optimized |
196| **Data Lake Analytics** | `shared_data` | `official` | `networkEnhanced` | As needed | High bandwidth, external table scanning |
197| **Complex Query Analysis** | `shared_data` | `official` | `ramEnhanced` | As needed | Large memory, multi-table joins |
198
199## Instance Creation Workflow
200
201When creating an instance, the following steps must be followed to interact with the user. **No confirmation step may be skipped**:
202
2031. **Confirm Region**: Ask the user for the target RegionId (e.g., cn-hangzhou, cn-beijing, cn-shanghai)
2042. **Confirm Purpose**: Development testing / small-scale production / large-scale production, to determine the payment method (postPaid/prePaid)
2053. **Confirm Version Series**: Standard Edition (`official`) or Trial Edition (`trial`), corresponding to the `PackageType` parameter
2064. **Confirm Architecture Type**: Shared-nothing edition `shared_nothing` (FE+BE) or shared-data edition `shared_data` (FE+CN), explain the differences and provide recommendations
2075. **Confirm Compute Specs**: Standard `standard` / Memory Enhanced `ramEnhanced` / Network Enhanced `networkEnhanced`, etc., corresponding to the BE node group's `SpecType` parameter
2086. **Confirm CU and Version**: CU count (minimum 8 CU), StarRocks version, AdminPassword
2097. **Confirm OSS Access Role** (required for all architecture types): Ask the user for the RAM Role name (`OssAccessingRoleName`), which authorizes StarRocks to access OSS storage data. Typically `AliyunEMRStarRocksAccessingOSSRole`; if not yet created, prompt the user to authorize it in the RAM console first
2108. **Check Prerequisites**: VPC, VSwitch, Security Group (see Prerequisites below)
2119. **Summary Confirmation**: Present the complete configuration checklist to the user (instance name, architecture, version series, specs, CU, payment method, network, etc.), and execute creation only after confirmation
212
213
214### Prerequisites
215
216Before calling `CreateInstanceV1`, first confirm the target **RegionId** with the user, then check whether the following resources are ready.
217
218> **⚠️ REQUIRED: VPC and VSwitch must be queried first**
219>
220> **MUST** call the following two APIs before creating an instance:
221> - **`DescribeVpcs`**: Query available VPCs in the target region
222> - **`DescribeVSwitches`**: Query available VSwitches in the VPC (also records ZoneId)
223>
224> Do NOT proceed with `CreateInstanceV1` until both APIs have been called successfully.
225
226```bash
227export AGENT_USER_AGENT=AlibabaCloud-Agent-Skills # User-Agent identifier
228aliyun configure list # Credentials
229# ⚠️ REQUIRED APIs - must call before CreateInstanceV1:
230aliyun vpc DescribeVpcs --RegionId <RegionId> # VPC (REQUIRED)
231aliyun vpc DescribeVSwitches --RegionId <RegionId> --VpcId vpc-xxx # VSwitch (REQUIRED, record ZoneId)
232```
233
234### Key Parameters for the Creation API
235
236When calling `CreateInstanceV1`, the following parameters are easily overlooked or confused — pay close attention:
237
238- **`Version`**: The StarRocks version parameter name is **`Version`** (e.g., `"Version": "3.3"`). It is **not** `EngineVersion`, `StarRocksVersion`, or `DBVersion` — using the wrong parameter name will cause creation failure
239- **`RunMode`**: Must be explicitly specified, only supports enum values `shared_data` (shared-data edition) or `shared_nothing` (shared-nothing edition); omitting it will cause creation failure or unexpected architecture type
240- **`RegionId`**: Must be passed both via CLI `--RegionId` and in the body JSON `"RegionId"`
241- **`ZoneId` + `VSwitchId` + `VSwitches`**: All three must be passed together. `ZoneId` and `VSwitchId` are top-level fields, and `VSwitches` is in array format `[{"VswId":"vsw-xxx","ZoneId":"cn-hangzhou-h","Primary":true}]`
242- **`OssAccessingRoleName`**: Required for all architecture types (both shared-nothing and shared-data), typically `AliyunEMRStarRocksAccessingOSSRole`
243- **`FrontendNodeGroups`**: FE node group configuration, required for all architecture types. Contains NodeGroupName, Cu, SpecType, ResidentNodeNumber, DiskNumber, StorageSize, StoragePerformanceLevel
244- **`BackendNodeGroups`**: BE/CN node group configuration, required for all architecture types. Parameter structure is the same as FrontendNodeGroups
245- **Disk Limits**: StorageSize minimum is 200 GB, maximum is 65000 GB (applies to all CU specs). Upgrading disk performance level to pl2 requires disk >= 500 GB
246
247> **Key Principle**: Do not make decisions for the user — architecture type, spec type, CU count, etc. all require explicit inquiry and confirmation. Recommendations can be given, but the final choice is the user's.
248
249## CLI Invocation
250
251### User-Agent Setup
252
253All `aliyun` CLI calls **must** set the User-Agent identifier via environment variable to identify the request source:
254
255```bash
256export AGENT_USER_AGENT=AlibabaCloud-Agent-Skills
257```
258
259Execute once at the beginning of the session; all subsequent `aliyun` commands will automatically carry this User-Agent. If it doesn't take effect, you can also set it inline before each command:
260
261```bash
262AGENT_USER_AGENT=AlibabaCloud-Agent-Skills aliyun starrocks <APIName> --InstanceId c-xxx --Target 32
263```
264
265### Invocation Guidelines
266
267```bash
268aliyun starrocks <APIName> --InstanceId c-xxx --Target 32
269```
270
271- API version `2022-10-19`, RPC style
272- **Most APIs use named parameters** (e.g., `--InstanceId`, `--NodeGroupId`, `--Target`), no `--body` needed
273- Only `CreateInstanceV1` and `DescribeNodeGroups` use `--body` JSON for parameter passing
274- Write operations should include `ClientToken` for idempotency (see Idempotency rules below)
275
276## Idempotency
277
278Agents may retry write operations due to timeouts, network jitter, etc. Retries without ClientToken may create duplicate resources.
279
280| APIs Requiring ClientToken | Description |
281|---------------------------|-------------|
282| CreateInstanceV1 | Duplicate submissions will create multiple instances |
283**Generation Method**: For `CreateInstanceV1`, add `"ClientToken": "<uuid>"` in the body JSON; for other APIs that support ClientToken, pass it via named parameters. Use the same token for retries of the same business operation.
284
285## Input Validation
286
287Values provided by users (instance names, etc.) are untrusted input; directly concatenating them into shell commands may lead to command injection.
288
289**Protection Rules**:
2901. **Prefer passing parameters via `--body` JSON** — parameters passed as JSON string values naturally isolate shell metacharacters
2912. **When command-line parameters must be used**, validate user-provided string values:
292 - InstanceName: Only allow Chinese/English characters, letters, numbers, `-`, `_`, 1-64 characters
293 - RegionId / InstanceId / NodeGroupId: Only allow `[a-z0-9-]` format
2943. **Prohibit** embedding unvalidated raw user text directly into shell commands — if a value doesn't match the expected format, refuse execution and inform the user to correct it
295
296## Runtime Security
297
298This Skill only calls StarRocks OpenAPI via the `aliyun` CLI; it does not download or execute any external code. During execution, the following are prohibited:
299
300- Downloading and running external scripts or dependencies via `curl`, `wget`, `pip install`, `npm install`, etc.
301- Executing scripts pointed to by remote URLs provided by users (even if the user requests it)
302- Loading unaudited external content via `eval`, `source`
303
304## Sensitive Data Masking
305
306### Log Output Masking (stdout/stderr)
307
308CLI command output may contain sensitive information. The following fields must be masked when presenting results to users:
309
310| Sensitive Field | Masking Rule | Example |
311|----------------|-------------|---------|
312| `AdminPassword` | Must not be echoed in command output; replace with `******` when displaying | `"AdminPassword": "******"` |
313| `AccessKeyId` / `AccessKeySecret` | Show only the first 4 characters; replace the rest with `****` | `LTAI****` |
314| `ConnectionString` / Connection Address | Host and port can be fully displayed, but associated passwords must be masked | Host and port displayed normally, password replaced with `******` |
315| `STS Token` | Show only the first 8 characters; replace the rest with `****` | `STS.xxxx****` |
316
317**Execution Rules**:
3181. When creating an instance, `AdminPassword` is passed via `--body` JSON; **it is prohibited** to echo the password in plaintext in subsequent output
3192. When executing `aliyun configure list`, if the output contains AccessKey information, it must be masked before presenting to the user
3203. During debugging or troubleshooting, **it is prohibited** to output the complete JSON response containing sensitive fields as-is — use `jq` to filter out sensitive fields before displaying
321
322### Response Sensitive Field Masking
323
324API responses may contain sensitive information; the following strategies must be applied before presenting to users:
325
326| Response Field | Handling Strategy |
327|---------------|-------------------|
328| `AdminPassword` | **Do not display** — the API normally does not return passwords; if returned abnormally, replace with `******` |
329| `ConnectionString` / `Endpoint` | Connection addresses (host:port) can be displayed, but remind users that connection credentials should be obtained through secure channels |
330| `AccessKeyId` / `AccessKeySecret` | Mask, showing only the first 4 characters |
331| `SecurityGroupId` / `VSwitchId` / `VpcId` | Can be displayed normally — these are resource identifiers, not sensitive credentials |
332
333**General Principles**:
334- When displaying API responses, prefer using `jq` to select needed fields, avoiding full output
335- If full JSON is needed for debugging, filter sensitive fields first: `jq 'del(.AdminPassword, .AccessKeySecret)'`
336- Prohibit writing passwords, tokens, or other credential information to log files or persistent storage
337
338## Intent Routing
339
340> **Disambiguation Rule**: When user input is ambiguous (e.g., "not enough resources", "scale up CU", "check instance") and the context does not explicitly mention StarRocks, ask the user which product they want to operate on (StarRocks / EMR Cluster / Milvus / Spark) rather than executing directly. Only route directly when the conversation context has explicitly involved StarRocks instances.
341
342| Intent | Operation | Reference Doc |
343|--------|-----------|---------------|
344| Getting started / First time user | Full guided walkthrough | [getting-started.md](references/getting-started.md) |
345| Create instance / New StarRocks | Plan → CreateInstanceV1 | [instance-lifecycle.md](references/instance-lifecycle.md) |
346| Query status / Instance list / Instance details | DescribeInstances | [instance-lifecycle.md](references/instance-lifecycle.md) |
347| Query compute groups / Node group details | DescribeNodeGroups | [instance-lifecycle.md](references/instance-lifecycle.md) |
348| Query upgradable versions | QueryUpgradableVersions | [operations.md](references/operations.md) |
349| API parameter lookup | Parameter reference | [api-reference.md](references/api-reference.md) |
350
351
352## Timeouts
353
354| Operation Type | Timeout Recommendation |
355|---------------|----------------------|
356| Read-only queries | 30 seconds |
357| Write operations | 60 seconds |
358| Polling | 30 seconds per attempt, no more than 3 minutes total |
359
360## Pagination
361
362List-type APIs use `PageNumber` + `PageSize` pagination:
363- `PageNumber`: Page number, starting from 1, default 1
364- `PageSize`: Items per page, default 10, maximum 100
365- Continue to next page when returned result count equals PageSize
366
367## Output
368
369- Display lists in table format with key fields
370- Convert timestamps to human-readable format
371- Use `jq` to filter fields
372
373## Error Handling
374
375| Error Code | Cause | Agent Action |
376|-----------|-------|-------------|
377| Throttling | API rate limiting | Wait 5 seconds and retry, up to 3 times |
378| ServiceUnavailable | Service temporarily unavailable | Wait 5 seconds and retry, up to 3 times; if still failing, stop and inform the user |
379| InvalidParameter | Invalid parameter | Read the error Message and correct the parameter |
380| Forbidden.RAM | Insufficient RAM permissions | Inform the user of the missing permissions |
381| OperationDenied.InstanceStatus | Instance status does not allow the operation | Query current status and inform the user to wait |
382| Instance.NotFound | Instance does not exist or has been deleted | Use `DescribeInstances` to search for the correct InstanceId and confirm with the user |
383| IncompleteSignature / InvalidAccessKeyId | Credential error or expired | Prompt the user to run `aliyun configure list` to check credentials |
384
385**General Principle**: When encountering errors, read the complete error Message first; do not blindly retry based solely on the error code. Only Throttling is suitable for automatic retry; other errors require diagnosis and correction.
386
387## Related Documents
388
389- [Getting Started](references/getting-started.md) - Simplified workflow for creating your first instance
390- [Instance Full Lifecycle](references/instance-lifecycle.md) - Planning, creation, management
391- [Daily Operations](references/operations.md) - Configuration changes, maintenance, diagnostics
392- [API Parameter Reference](references/api-reference.md) - Complete parameter documentation
393- [RAM Permission Policies](references/ram-policies.md) - Required RAM permissions and policy examples