All Products
Search
Document Center

Alibaba Cloud Service Mesh:Install and use ASM CLI

Last Updated:Dec 20, 2023

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

  1. Install ASM CLI.

    1. 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"
    2. Run the following command to decompress the package of ASM CLI:

      tar xzvf aliyun-cli-linux-${VERSION}-amd64.tgz
    3. Run the following command to install ASM CLI:

      sudo mv aliyun /usr/local/bin
  2. Initialize ASM CLI.

    1. 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}
    2. 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}
    3. Run the following command to specify the region where you use ASM CLI, for example, cn-beijing:

      Default Region Id []: cn-beijing
      Table 1. Available regions

      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

    4. 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"
      }
    }
  }
}