ASM CLI is a command line tool. You can run the aliyun servicemesh
command on ASM CLI to call all API operations that Service Mesh (ASM) provides for external access.
Background information
ASM CLI is integrated into Alibaba Cloud Command Line Interface (CLI). You can obtain the latest version of ASM CLI by downloading the unified aliyun-cli release package.
Install and initialize ASM CLI
Install ASM CLI.
Run the following command to specify the version of ASM CLI. In this example, the latest version 3.0.214 is used.
VERSION=3.0.214
Run the following command to download ASM CLI:
wget "https://github.com/aliyun/aliyun-cli/releases/download/v${VERSION}/aliyun-cli-linux-${VERSION}-amd64.tgz"
Run the following command to decompress ASM CLI:
tar xzvf aliyun-cli-linux-${VERSION}-amd64.tgz
Run the following command to install ASM CLI:
sudo mv aliyun /usr/local/bin
Run the following command to check whether ASM CLI is installed:
aliyun version
Expected output:
3.0.214
If a message that indicates the version of ASM CLI is returned, ASM CLI is installed.
Initialize ASM CLI.
Run the following command to initialize ASM CLI:
aliyun configure
Run the following command to specify the AccessKey ID of your Alibaba Cloud account. Replace ACCESS_KEY_ID with the AccessKey ID of your Alibaba Cloud account.
Access Key Id []: {ACCESS_KEY_ID}
Run the following command to specify the AccessKey secret of your Alibaba Cloud account. Replace ACCESS_KEY_SECRET with the AccessKey secret of your Alibaba Cloud account.
Access Key Secret []: {ACCESS_KEY_SECRET}
Run the following command to specify the region where you use ASM CLI, for example, cn-hangzhou:
Default Region Id []: cn-hangzhou
Table 1. Available region
Region
Region ID
Endpoint
China (Hangzhou)
cn-hangzhou
https://servicemesh.aliyuncs.com
China (Beijing)
cn-beijing
China (Shanghai)
cn-shanghai
US (Silicon Valley)
us-west-1
Singapore
ap-southeast-1
China (Shenzhen)
cn-shenzhen
China (Zhangjiakou)
cn-zhangjiakou
Run the following command to specify the language that you want to use on ASM CLI:
Default Output Format [json]: json (Only support json) Default Language [zh|en] en: en
Use ASM CLI
For information about all API operations of ASM, see List of operations by function. In the following example, the DescribeServiceMeshDetail
operation is called to demonstrate how to use ASM CLI. The DescribeServiceMeshDetail operation is used to query the details of an ASM instance. In the following code, set the ServiceMeshId parameter to the ID of the ASM instance that you want to query.
aliyun servicemesh DescribeServiceMeshDetail --ServiceMeshId c9e8589cc0afa430c80bc1541b6d6xxxx
{
"RequestId": "fac9c43c-0f78-45a9-b212-b48c9c4fxxxx",
"ServiceMesh": {
"Clusters": [
"c4d810b9cc91e4170958c674419c2xxxx"
],
"Endpoints": {
"IntranetApiServerEndpoint": "https://192.168.0.xxx:6443",
"IntranetPilotEndpoint": "192.168.0.xxx:15012",
"PublicApiServerEndpoint": "https://39.105.207.xxx:6443",
"PublicPilotEndpoint": "39.105.121.xxx:15012"
},
"ServiceMeshInfo": {
"CreationTime": "2020-08-03T15:39:45+08:00",
"ErrorMessage": "",
"Name": "bj",
"RegionId": "cn-beijing",
"ServiceMeshId": "c9e8589cc0afa430c80bc1541b6d6xxxx",
"State": "running",
"UpdateTime": "2020-09-08T14:20:33+08:00",
"Version": "v1.6.8.0-g36ddadd7-aliyun"
},
"Spec": {
"LoadBalancer": {
"ApiServerLoadbalancerId": "lb-2ze3ng35hedvvsnfkxxxx",
"ApiServerPublicEip": true,
"PilotPublicEip": true,
"PilotPublicLoadbalancerId": "lb-2zenjnpcwgm99ecr0xxxx"
},
"MeshConfig": {
"Audit": {
"Enabled": true,
"Project": "mesh-log-c9e8589cc0afa430c80bc1541b6d6xxxx"
},
"CustomizedZipkin": false,
"EnableLocalityLB": false,
"IncludeIPRanges": "*",
"OPA": {
"Enabled": false
},
"OutboundTrafficPolicy": "ALLOW_ANY",
"Pilot": {
"TraceSampling": 100
},
"Telemetry": true,
"Tracing": true
},
"Network": {
"SecurityGroupId": "sg-2zegx3q19bmgefu0xxxx",
"VSwitches": [
"vsw-2zergbfy911jjxkiwxxxx"
],
"VpcId": "vpc-2zebfarsa6f57itxfxxxx"
}
}
}
}