Alibaba Cloud Container Service for Kubernetes (ACK) SDK

raw JSON →
6.6.0 verified Fri May 01 auth: no python

Official Alibaba Cloud SDK for managing Container Service for Kubernetes (ACK) clusters. Version 6.6.0, updated frequently. Supports cluster creation, scaling, node management, and credential retrieval.

pip install alibabacloud-cs20151215
error ModuleNotFoundError: No module named 'alibabacloud_cs20151215'
cause Package not installed or incorrect environment.
fix
Run: pip install alibabacloud-cs20151215
error AttributeError: module 'alibabacloud_cs20151215' has no attribute 'Client'
cause Importing from wrong module; Client is in .client submodule.
fix
Use: from alibabacloud_cs20151215.client import Client
error UnboundRequiredParameterError: Required parameter 'name' is not bound
cause Missing required field in a request model (e.g., CreateClusterRequest).
fix
Ensure all required fields are set on the model instance before passing to client.
breaking Version 6.x uses a new client initialization pattern. Old pattern with AccessKeyId parameter directly is removed.
fix Use alibabacloud_tea_openapi.models.Config to create config object.
deprecated Method 'describe_cluster_detail' is deprecated in favor of 'describe_cluster_v2'.
fix Use client.describe_cluster_v2(request) instead.
gotcha Region ID must be set in the Config object; omitting it causes region-related 400 errors.
fix Always set region_id in the config, even for global services.
gotcha Cluster creation requests (CreateClusterRequest) have many required nested fields; missing sub-fields cause unclear validation errors.
fix Use the SDK's builder or thoroughly populate all required nested model attributes.

Initialize client and list clusters. Replace region_id and set env vars ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET.

import os
from alibabacloud_cs20151215.client import Client
from alibabacloud_cs20151215 import models
from alibabacloud_tea_openapi import models as open_api_models

# Configure credentials (use environment variables for security)
config = open_api_models.Config(
    access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID'),
    access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET'),
    region_id='cn-hangzhou'
)
client = Client(config)

# Describe clusters (list)
req = models.DescribeClustersV1Request()
resp = client.describe_clusters_v1(req)
print(resp.body.clusters)