Loading...
Loading...
Alibaba Cloud Elasticsearch Instance Management Skill. Use for creating, querying, listing, and restarting Elasticsearch instances on Alibaba Cloud. Triggers: "elasticsearch", "ES instance", "elasticsearch instance", "create ES", "query ES instance", "restart ES", "ES node", "cluster node"
npx skill4agent add aliyun/alibabacloud-aiops-skills alibabacloud-elasticsearch-instance-manageAlibaba Cloud Elasticsearch Instance Management
├── createInstance (Create Instance)
├── DescribeInstance (Query Instance Details)
├── ListInstance (List Instances)
├── ListAllNode (Query Cluster Node Info)
└── RestartInstance (Restart Instance)Pre-check: Aliyun CLI >= 3.3.1 required Runto verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] runaliyun versionto enable automatic plugin installation.aliyun configure set --auto-plugin-install true
# Verify CLI version
aliyun version
# Enable auto plugin installation
aliyun configure set --auto-plugin-install truePre-check: Alibaba Cloud Credentials RequiredSecurity Rules (MUST FOLLOW):
- NEVER read, echo, or print AK/SK values
- NEVER ask the user to input AK/SK directly in the conversation
- NEVER use
with literal credential valuesaliyun configure set- NEVER accept AK/SK provided directly by users in the conversation
- ONLY read credentials from environment variables or pre-configured CLI profiles
⚠️ CRITICAL: Handling User-Provided CredentialsIf a user attempts to provide AK/SK directly (e.g., "My AK is xxx, SK is yyy"):
- STOP immediately - Do NOT execute any command
- Reject the request politely with the following message:
For your account security, please do not provide Alibaba Cloud AccessKey ID and AccessKey Secret directly in the conversation. Please use the following secure methods to configure credentials: Method 1: Interactive configuration via aliyun configure (Recommended) aliyun configure # Enter AK/SK as prompted, credentials will be securely stored in local config file Method 2: Configure via environment variables export ALIBABA_CLOUD_ACCESS_KEY_ID=<your-access-key-id> export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<your-access-key-secret> After configuration, please retry your request.- Do NOT proceed with any Alibaba Cloud operations until credentials are properly configured
Check CLI configuration:bashaliyun configure listCheck the output for a valid profile (AK, STS, or OAuth identity).If no valid credentials exist, STOP here.
elasticsearch:CreateInstanceelasticsearch:DescribeInstanceelasticsearch:ListInstanceelasticsearch:ListAllNodeelasticsearch:RestartInstanceNote: Elasticsearch APIs use ROA (RESTful) style. You can useto specify the HTTP request body as a JSON string. See examples in each task below.--body
Idempotency: For write operations (create, restart, delete, etc.), you MUST use theparameter to ensure idempotency.--client-token
- Use a UUID format unique identifier as clientToken
- When a request times out or fails, you can safely retry with the same clientToken. When retrying after timeout, it is recommended to wait 10 seconds before retrying
- Duplicate requests with the same clientToken will not execute the operation repeatedly
- Generation method: Prefer using uuidgen or PowerShell GUID; if the environment doesn't support it, generate a UUID format string directly; if strict randomness is not required, use idem-timestamp-semantic-identifier as a fallback. Do not interrupt the process due to unavailable commands.
⚠️ CRITICAL: Required Parameters and Region ValidationWhen creating an ES instance, parameters such as,--region,esAdminPassword,vpcId,vswitchId,vsAreaMUST be explicitly provided by the user.paymentTypeImportant Notes:
- The
parameter MUST NOT be guessed or use default values--region- If the user does not provide a region or provides an invalid region, you MUST clearly prompt the user to provide a valid region
For detailed validation rules, refer to related-apis.md - createInstance Required Parameters and Region Validation
# Generate idempotency token first
CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance \
--region <RegionId> \
--client-token $CLIENT_TOKEN \
--body '{
"esAdminPassword": "<Password>",
"esVersion": "7.10_with_X-Pack",
"nodeAmount": 2,
"nodeSpec": {
"disk": 20,
"diskType": "cloud_ssd",
"spec": "elasticsearch.sn2ne.large.new"
},
"networkConfig": {
"vpcId": "<VpcId>",
"vswitchId": "<VswitchId>",
"vsArea": "<ZoneId>",
"type": "vpc"
},
"paymentType": "postpaid",
"description": "<InstanceName>"
}' \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills# Generate idempotency token (use the same token when retrying after timeout)
CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance \
--region cn-hangzhou \
--client-token $CLIENT_TOKEN \
--body '{
"esAdminPassword": "YourPassword123!",
"esVersion": "7.10_with_X-Pack",
"nodeAmount": 2,
"nodeSpec": {
"disk": 20,
"diskType": "cloud_ssd",
"spec": "elasticsearch.sn2ne.large.new"
},
"networkConfig": {
"vpcId": "vpc-bp1xxx",
"vswitchId": "vsw-bp1xxx",
"vsArea": "cn-hangzhou-i",
"type": "vpc"
},
"paymentType": "postpaid",
"description": "my-es-instance",
"kibanaConfiguration": {
"spec": "elasticsearch.sn1ne.large",
"amount": 1,
"disk": 0
}
}' \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills# Generate idempotency token
CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance \
--region cn-hangzhou \
--client-token $CLIENT_TOKEN \
--body '{
"esAdminPassword": "YourPassword123!",
"esVersion": "7.10_with_X-Pack",
"nodeAmount": 2,
"nodeSpec": {
"disk": 20,
"diskType": "cloud_ssd",
"spec": "elasticsearch.sn2ne.large.new"
},
"networkConfig": {
"vpcId": "vpc-bp1xxx",
"vswitchId": "vsw-bp1xxx",
"vsArea": "cn-hangzhou-i",
"type": "vpc"
},
"paymentType": "postpaid",
"description": "my-es-instance",
"zoneCount": "2",
"kibanaConfiguration": {
"spec": "elasticsearch.sn1ne.large",
"amount": 1,
"disk": 0
},
"masterConfiguration": {
"amount": 3,
"disk": 20,
"diskType": "cloud_essd",
"spec": "elasticsearch.sn2ne.xlarge"
}
}' \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills⚠️ Important: Required Parameters Must Be Provided by User When querying instance details,and--regionmust be explicitly provided by the user. Do not guess the region. For detailed instructions, refer to related-apis.md - DescribeInstance Required Parameters--instance-id
aliyun elasticsearch describe-instance \
--region <RegionId> \
--instance-id <InstanceId> \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skillsaliyun elasticsearch describe-instance \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills⚠️ Important: Required Parameters and Parameter Validation
- The
parameter must be explicitly provided by the user. Do not guess or use default values.--region- The
parameter only supports valid values:--status,activating,active,inactive(case-sensitive)invalid- For detailed instructions, refer to related-apis.md - ListInstance Required Parameters and Parameter Validation
aliyun elasticsearch list-instance \
--region <RegionId> \
--page 1 \
--size 10 \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills# List all instances
aliyun elasticsearch list-instance \
--region cn-hangzhou \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills
# Filter by status
aliyun elasticsearch list-instance \
--region cn-hangzhou \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills
# Filter by name (fuzzy match)
aliyun elasticsearch list-instance \
--region cn-hangzhou \
--description "my-es" \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills⚠️ CRITICAL: Pre-restart Check RequirementsBefore executing a restart operation, you must first query the instance status and confirm it is: Pre-check Rules:active
- Only when the instance status is
can you execute the restart operationactive- If the instance status is abnormal (such as
,activating,inactive, etc.), restart operation is prohibitedinvalid- If the instance status is abnormal, you should inform the user that the current status is not suitable for restart and recommend waiting for the instance to recover or contacting Alibaba Cloud technical support
# Generate idempotency token
CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch restart-instance \
--region <RegionId> \
--instance-id <InstanceId> \
--client-token $CLIENT_TOKEN \
--body '<JSON_BODY>' \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills# Generate idempotency token
CLIENT_TOKEN=$(uuidgen)
# Normal restart
aliyun elasticsearch restart-instance \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--client-token $CLIENT_TOKEN \
--body '{"restartType":"instance"}' \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills
# Force restart
aliyun elasticsearch restart-instance \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--client-token $CLIENT_TOKEN \
--body '{"restartType":"instance","force":true}' \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills
# Restart specific nodes
aliyun elasticsearch restart-instance \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--client-token $CLIENT_TOKEN \
--body '{"restartType":"nodeIp","nodes":["10.0.XX.XX","10.0.XX.XX"]}' \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skillsaliyun elasticsearch list-all-node \
--region <RegionId> \
--instance-id <InstanceId> \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills| Parameter | Required | Description |
|---|---|---|
| Yes | Instance ID |
| No | Whether to return node monitoring information, default true |
# List all nodes with monitoring info
aliyun elasticsearch list-all-node \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills
# Query specific fields
aliyun elasticsearch list-all-node \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--cli-query "Result[].{Host:host,Type:nodeType,Health:health,CPU:cpuPercent,Heap:heapPercent,Disk:diskUsedPercent}" \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills| Field | Description |
|---|---|
| Node IP address |
| Node type: MASTER/WORKER/WORKER_WARM/COORDINATING/KIBANA |
| Node health status: GREEN/YELLOW/RED/GRAY |
| CPU usage rate |
| JVM memory usage rate |
| Disk usage rate |
| One minute load |
| Availability zone where the node is located |
| Node access port |
# Check instance status
aliyun elasticsearch describe-instance \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--cli-query "Result.status" \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skillsactive--cli-query--description--client-tokenuuidgen# Example: Safe retry pattern
CLIENT_TOKEN=$(uuidgen)
echo "Using clientToken: $CLIENT_TOKEN"
# First attempt
aliyun elasticsearch create-instance --client-token $CLIENT_TOKEN ...
# If timeout, retry with the same Token
aliyun elasticsearch create-instance --client-token $CLIENT_TOKEN ...| Reference | Description |
|---|---|
| related-apis.md | API and CLI command details |
| ram-policies.md | RAM permission policies |
| verification-method.md | Verification steps |
| acceptance-criteria.md | Correct/incorrect patterns |
| cli-installation-guide.md | CLI installation guide |
| node-specifications-by-region.md | Node specifications by region and role |