alicloud-compute-ecsManage Alibaba Cloud Elastic Compute Service (ECS) via OpenAPI/SDK. Use for listing or creating instances, starting/stopping/rebooting, managing disks/snapshots/images/security groups/key pairs/ENIs, querying status, and troubleshooting workflows for this product.
Install via ClawdBot CLI:
clawdbot install cinience/alicloud-compute-ecsCategory: service
Use Alibaba Cloud OpenAPI (RPC) with official SDKs or OpenAPI Explorer to manage ECS resources.
Prefer the Python SDK for all examples and execution.
PageNumber + PageSize or NextToken + MaxResults.DescribeInstances returns an empty list if the RAM user/role lacks permissions; use DryRun to validate permissions.DescribeInstances, NextToken + MaxResults is the recommended paged query pattern; use the returned NextToken to fetch subsequent pages.DescribeInstances requires RegionId in the request even if the client has a region set.1) Confirm region, resource identifiers, and desired action.
2) Find API group and exact operation name in references/api_overview.md.
3) Call API with Python SDK (preferred) or OpenAPI Explorer.
4) Verify results with describe/list APIs.
5) If you need repeatable inventory or summaries, use scripts/ and write outputs under output/alicloud-compute-ecs/.
1) Python SDK (preferred)
2) OpenAPI Explorer
3) Other SDKs (only if Python is not feasible)
æšè䜿çšèæç¯å¢ïŒé¿å PEP 668 çç³»ç»å®è£ éå¶ïŒã
python3 -m venv .venv
. .venv/bin/activate
python -m pip install alibabacloud_ecs20140526 alibabacloud_tea_openapi alibabacloud_credentials
from alibabacloud_ecs20140526.client import Client as Ecs20140526Client
from alibabacloud_ecs20140526 import models as ecs_models
from alibabacloud_tea_openapi import models as open_api_models
def create_client(region_id: str) -> Ecs20140526Client:
config = open_api_models.Config(
# Use env vars or shared config files per AccessKey priority.
region_id=region_id,
endpoint=f"ecs.{region_id}.aliyuncs.com",
)
return Ecs20140526Client(config)
def list_instances(region_id: str):
client = create_client(region_id)
resp = client.describe_instances(ecs_models.DescribeInstancesRequest(
region_id=region_id,
page_number=1,
page_size=50,
))
for inst in resp.body.instances.instance:
print(inst.instance_id, inst.instance_name, inst.instance_type, inst.status)
if __name__ == "__main__":
list_instances("cn-hangzhou")
scripts/list_instances_all_regions.pyscripts/summary_instance_specs.pyscripts/summary_instances_by_region.pyscripts/summary_instances_by_status.pyscripts/summary_instances_by_instance_type.pyscripts/summary_instances_by_vpc.pyscripts/summary_instances_by_security_group.pyfrom alibabacloud_ecs20140526.client import Client as Ecs20140526Client
from alibabacloud_ecs20140526 import models as ecs_models
from alibabacloud_tea_openapi import models as open_api_models
def create_client(region_id: str) -> Ecs20140526Client:
config = open_api_models.Config(
region_id=region_id,
endpoint=f"ecs.{region_id}.aliyuncs.com",
)
return Ecs20140526Client(config)
def list_regions() -> list[str]:
client = create_client("cn-hangzhou")
resp = client.describe_regions(ecs_models.DescribeRegionsRequest())
return [r.region_id for r in resp.body.regions.region]
def list_instances_all_regions():
for region_id in list_regions():
client = create_client(region_id)
req = ecs_models.DescribeInstancesRequest(
region_id=region_id,
page_number=1,
page_size=100,
)
resp = client.describe_instances(req)
print(f"== {region_id} ({resp.body.total_count}) ==")
for inst in resp.body.instances.instance:
print(inst.instance_id, inst.instance_name, inst.instance_type, inst.status)
if __name__ == "__main__":
list_instances_all_regions()
from alibabacloud_ecs20140526.client import Client as Ecs20140526Client
from alibabacloud_ecs20140526 import models as ecs_models
from alibabacloud_tea_openapi import models as open_api_models
def create_client(region_id: str) -> Ecs20140526Client:
config = open_api_models.Config(
region_id=region_id,
endpoint=f"ecs.{region_id}.aliyuncs.com",
)
return Ecs20140526Client(config)
def list_instances_paged(region_id: str):
client = create_client(region_id)
page_number = 1
page_size = 100
while True:
resp = client.describe_instances(ecs_models.DescribeInstancesRequest(
region_id=region_id,
page_number=page_number,
page_size=page_size,
))
for inst in resp.body.instances.instance:
print(inst.instance_id, inst.instance_name, inst.instance_type, inst.status)
total = resp.body.total_count
if page_number * page_size >= total:
break
page_number += 1
if __name__ == "__main__":
list_instances_paged("cn-hangzhou")
from alibabacloud_ecs20140526.client import Client as Ecs20140526Client
from alibabacloud_ecs20140526 import models as ecs_models
from alibabacloud_tea_openapi import models as open_api_models
def create_client(region_id: str) -> Ecs20140526Client:
config = open_api_models.Config(
region_id=region_id,
endpoint=f"ecs.{region_id}.aliyuncs.com",
)
return Ecs20140526Client(config)
def list_types(region_id: str, zone_id: str | None = None, instance_type_family: str | None = None):
client = create_client(region_id)
req = ecs_models.DescribeInstanceTypesRequest(
zone_id=zone_id,
instance_type_family=instance_type_family,
)
resp = client.describe_instance_types(req)
for t in resp.body.instance_types.instance_type:
print(t.instance_type_id, t.cpu_core_count, t.memory_size)
if __name__ == "__main__":
list_types("cn-hangzhou", "cn-hangzhou-k")
RunInstances, CreateInstance, StartInstance(s), StopInstance(s), RebootInstance(s), DeleteInstance(s)DescribeInstances, DescribeInstanceStatus, DescribeInstanceAttributeModifyInstanceSpec, ModifyPrepayInstanceSpec, DescribeResourcesModificationReplaceSystemDisk, ResetDiskCreateDisk, AttachDisk, DetachDisk, ResizeDisk, DescribeDisksCreateSnapshot, CopySnapshot, DescribeSnapshots, DeleteSnapshotCreateImage, CopyImage, DescribeImages, DeleteImage, ModifyImageAttributeCreateSecurityGroup, AuthorizeSecurityGroup, RevokeSecurityGroup, DescribeSecurityGroupAttributeCreateKeyPair, ImportKeyPair, DescribeKeyPairs, DeleteKeyPairsCreateNetworkInterface, AttachNetworkInterface, DetachNetworkInterface, DescribeNetworkInterfacesTagResources, UntagResources, ListTagResourcesDescribeInstancesFullStatus, DescribeInstanceHistoryEvents, DescribeInstanceMonitorDataDescribeInstances (supports filters such as VpcId, VSwitchId, ZoneId, SecurityGroupId, InstanceIds)DescribeInstances with PageSize=1 and read TotalCountDescribeRegions then loop all regions for inventoryRunning state.DescribeInvocations and DescribeInvocationResults.See references/command-assistant.md.
1) Environment variables: ALICLOUD_ACCESS_KEY_ID / ALICLOUD_ACCESS_KEY_SECRET / ALICLOUD_REGION_ID
Region policy: ALICLOUD_REGION_ID is an optional default. If unset, decide the most reasonable region for the task; if unclear, ask the user.
2) Shared config file: ~/.alibabacloud/credentials (region still from env)
Environment variables:
export ALICLOUD_ACCESS_KEY_ID="your-ak"
export ALICLOUD_ACCESS_KEY_SECRET="your-sk"
export ALICLOUD_REGION_ID="cn-hangzhou"
Also supported by the Alibaba Cloud SDKs:
export ALIBABA_CLOUD_ACCESS_KEY_ID="your-ak"
export ALIBABA_CLOUD_ACCESS_KEY_SECRET="your-sk"
Shared config file:
~/.alibabacloud/credentials
[default]
type = access_key
access_key_id = your-ak
access_key_secret = your-sk
Ecs2014-05-26If you need to save responses or generated artifacts, write them under:
output/alicloud-compute-ecs/
references/api_overview.mdreferences/endpoints.mdreferences/command-assistant.mdreferences/describe-instances.mdreferences/instances.mdreferences/disks.mdreferences/snapshots.mdreferences/images.mdreferences/security-groups.mdreferences/network-interfaces.mdreferences/keypairs.mdreferences/tags.mdreferences/monitoring-events.mdreferences/sources.mdGenerated Mar 1, 2026
IT teams use this skill to automate the provisioning, monitoring, and lifecycle management of virtual servers across multiple regions. It enables efficient scaling, cost optimization, and compliance checks by listing instances, managing security groups, and handling snapshots.
Organizations implement automated backup workflows by creating disk snapshots and managing images for ECS instances. This ensures data resilience and quick recovery in case of failures, with scripts to summarize instance statuses and configurations.
Development teams leverage the skill to spin up temporary ECS instances for testing environments, manage key pairs for secure access, and integrate with CI/CD pipelines. It supports rapid deployment and teardown of resources using Python SDK scripts.
Enterprises with global operations use this skill to gather comprehensive inventories of ECS instances across all regions. It helps in auditing resource usage, optimizing costs, and ensuring compliance with regional policies through automated summary reports.
Security teams utilize the skill to monitor ECS instances by querying statuses, managing ENIs, and reviewing security group configurations. It aids in detecting unauthorized changes and enforcing least-privilege access controls via API calls.
Providers offer outsourced management of Alibaba Cloud ECS resources, using this skill to automate monitoring, scaling, and troubleshooting for clients. This reduces operational overhead and ensures high availability with recurring service fees.
Consultants analyze ECS usage patterns with the skill's inventory scripts to recommend cost-saving measures and performance improvements. They charge for assessments and implementation of optimized workflows based on API insights.
SaaS platforms integrate this skill to offer built-in cloud management features, such as auto-scaling and backup for ECS instances. This enhances product value and drives user adoption through premium tiers or usage-based pricing.
ð¬ Integration Tip
Ensure AccessKey permissions are scoped to least privilege and use the Python SDK for reliable API interactions, as it handles signing and pagination automatically.
Automatically update Clawdbot and all installed skills once daily. Runs via cron, checks for updates, applies them, and messages the user with a summary of what changed.
Full desktop computer use for headless Linux servers. Xvfb + XFCE virtual desktop with xdotool automation. 17 actions (click, type, scroll, screenshot, drag,...
Essential Docker commands and workflows for container management, image operations, and debugging.
Tool discovery and shell one-liner reference for sysadmin, DevOps, and security tasks. AUTO-CONSULT this skill when the user is: troubleshooting network issues, debugging processes, analyzing logs, working with SSL/TLS, managing DNS, testing HTTP endpoints, auditing security, working with containers, writing shell scripts, or asks 'what tool should I use for X'. Source: github.com/trimstray/the-book-of-secret-knowledge
Deploy applications and manage projects with complete CLI reference. Commands for deployments, projects, domains, environment variables, and live documentation access.
Monitor topics of interest and proactively alert when important developments occur. Use when user wants automated monitoring of specific subjects (e.g., product releases, price changes, news topics, technology updates). Supports scheduled web searches, AI-powered importance scoring, smart alerts vs weekly digests, and memory-aware contextual summaries.