This topic describes how to use the Container Service for Kubernetes (ACK) SDK to call the ACK API to create an ACK managed cluster.
Prerequisites
Before you begin, ensure that you have:
An Alibaba Cloud account or RAM user — The calling identity must have API access. An Alibaba Cloud account has full access to all API operations; use a RAM user for routine O&M. For details, see Identity.
The AliyunCSFullAccess permission — Grant this policy to the RAM user that calls the API. For read-only access, grant AliyunCSReadOnlyAccess instead.
An AccessKey pair — Create one on the Authentication tab of the RAM user details page. For instructions, see Create an AccessKey pair.
Java and IntelliJ IDEA — Required to run the SDK demo project downloaded from OpenAPI Explorer.
Maven — The demo project uses Maven to manage dependencies.
Step 1: Read the API reference
Before calling the API, read Create an ACK managed cluster to understand the required and optional parameters. For a full list of ACK API operations, see List of operations by function.
Step 2: Set up a RAM user
Skip this step if you already have a RAM user with the AliyunCSFullAccess permission and an AccessKey pair.
Create a RAM user. Log on to the RAM console with your Alibaba Cloud account.
In the left-side navigation pane, choose Identities > Users.
On the Users page, click Create User.
On the Create User page, configure Logon Name and Display Name, and set Access Mode to Console Access.
Click OK. Record the username and password — you will use these to log on to OpenAPI Explorer console.
Grant the AliyunCSFullAccess permission to the RAM user. For instructions, see Grant permissions to a RAM user.
NoteAliyunCSFullAccess provides full permissions on Container Service for Kubernetes. AliyunCSReadOnlyAccess provides read-only access. For custom permission policies, see RAM authorization.
On the user details page, click the Authentication tab, then click Create AccessKey to generate an AccessKey pair.
Step 3: Call the API
This example uses ACK SDK for Java to call the CreateCluster API operation and create an ACK Pro cluster. SDKs for other languages work the same way. For a full list of supported SDKs, see Container Service for Kubernetes SDK. For alternative call methods, see Call methods.
Configure environment variables
Store your AccessKey credentials as environment variables rather than hardcoding them in source code. For setup instructions, see Configure environment variables in Linux, macOS, and Windows.
Download the SDK demo
Go to the CreateCluster API Explorer.CreateCluster
On the Parameters tab, enter the following sample values and click Initiate Call:
Parameter Sample value nametestregion_idcn-beijingcluster_typeManagedKubernetescluster_specack.pro.smallcluster_version1.30.1-aliyun.1vpcidvpc-2zedl8cyb7tnkaux1****container_cidr10.0.0.0/8service_cidr172.21.0.0/20vswitch_idsvsw-2ze7hfp0ah8rk1nz9****On the SDK Sample Code tab, select version 2.0, choose Java as the language, and click Download Project. Extract the downloaded package to your local machine.
NoteUse SDK version 2.0. For a comparison of version 1.0 and 2.0, see Alibaba Cloud SDK V1.0 and V2.0.

Run the SDK demo
Open IntelliJ IDEA, choose File > Open, and select the extracted project folder. Wait for Maven to finish installing dependencies.
Double-click Sample to open the entry class. Confirm no errors are shown, then run the sample code.
In the console output at the bottom of the IDE, search for
statusCode. A response containing"statusCode":202means the API call succeeded and ACK is creating the cluster.
To confirm the cluster is being created, log on to the ACK console and go to the Clusters page to view the newly created cluster.