All Products
Search
Document Center

Elastic Compute Service:DescribeCommands

Last Updated:Apr 14, 2026

You can view your custom Cloud Assistant commands or the public commands provided by Alibaba Cloud.

Operation description

API

  • To list all your manually created commands (CommandId), provide only the Action and RegionId request parameters.

  • Use MaxResults to limit the number of items to return. If a response includes a NextToken, more results are available. To retrieve the next page, pass the value of this NextToken in your subsequent request.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:DescribeCommands

get

Command

acs:ecs:{#regionId}:{#accountId}:command/*

Command

acs:ecs:{#regionId}:{#accountId}:command/{#commandId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The ID of the region. To view the latest list of regions, call the DescribeRegions operation.

cn-hangzhou

RegionId

string

Yes

The ID of the region. To view the latest list of regions, call the DescribeRegions operation.

cn-hangzhou

Provider

string

No

The provider of the public command.

  • If you omit this parameter, the operation queries your private commands by default.

  • Set this parameter to AlibabaCloud to query all public commands from Alibaba Cloud.

  • If you set the value to a specific provider, the public commands from that provider are queried. For example:
    • If you set Provider to AlibabaCloud.ECS.GuestOS, the public commands provided by AlibabaCloud.ECS.GuestOS are queried.

    • If you set Provider to AlibabaCloud.ECS.GuestOSDiagnose, the public commands provided by AlibabaCloud.ECS.GuestOSDiagnose are queried.

AlibabaCloud

CommandId

string

No

The ID of the command.

c-hz01272yr52****

Name

string

No

The name of the command.

  • If you specify the Provider parameter to query public commands, fuzzy search is supported by default.

  • If you do not specify the Provider parameter to query private commands, fuzzy search is supported. You can use an asterisk (*) as a wildcard. For example, command* returns all commands whose names start with command, *command returns all commands whose names end with command, and *command* returns all commands whose names contain command.

testName

Description

string

No

The description of the command.

  • If you specify the Provider parameter to query public commands, fuzzy search is supported by default.

  • If you do not specify the Provider parameter to query private commands, fuzzy search is supported. You can use an asterisk (*) as a wildcard. For example, test* returns all commands whose descriptions start with test, *test returns all commands whose descriptions end with test, and *test* returns all commands whose descriptions contain test.

testDescription

Type

string

No

The type of the command. Valid values:

  • RunBatScript: A Bat script for Windows instances.

  • RunPowerShellScript: A PowerShell script for Windows instances.

  • RunShellScript: A Shell script for Linux instances.

RunShellScript

ContentEncoding

string

No

The encoding format for the CommandContent and Output values in the response. Valid values:

  • PlainText: returns the raw script content and output.

  • Base64: returns the Base64-encoded script content and output.

Default value: Base64.

PlainText

PageNumber

integer

No

Note

This parameter is being deprecated. We recommend using NextToken and MaxResults for pagination instead.

1

PageSize

integer

No

Note

This parameter is being deprecated. We recommend using NextToken and MaxResults for pagination instead.

10

MaxResults

integer

No

The maximum number of entries to return per page.

Maximum value: 50.

Default value: 10.

10

NextToken

string

No

The pagination token for the next page of results. To retrieve the next page, set this parameter to the NextToken value from a previous call.

AAAAAdDWBF2

Latest

boolean

No

Specifies whether to return only the latest version of public commands. This parameter does not affect private commands.

  • true: returns only the latest version of public commands.

  • false: returns all versions of public commands.

Default value: false.

true

ResourceGroupId

string

No

The ID of the resource group to which the command belongs.

rg-123******

Tag

array<object>

No

The tags used to filter commands.

object

No

A tag object.

Value

string

No

The value of the tag. You can specify up to 20 tags. The tag value can be an empty string.

The value can be up to 128 characters in length and cannot contain http:// or https://.

TestValue

Key

string

No

The key of the tag. You can specify up to 20 tags. The tag key cannot be an empty string.

A query can return a maximum of 1,000 resources that match the specified tags. If more than 1,000 resources match, call the ListTagResources operation to query all matching resources.

The key can be up to 64 characters in length, cannot start with aliyun or acs:, and cannot contain http:// or https://.

TestKey

Response elements

Element

Type

Description

Example

object

PageSize

integer

The number of entries per page.

10

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

PageNumber

integer

The page number.

1

TotalCount

integer

The total number of commands.

5

NextToken

string

The pagination token that is used in the next request to retrieve a new page of results. If this parameter is not returned, all results have been retrieved.

AAAAAdDWBF2

Commands

object

Command

array<object>

The details of the commands.

array<object>

The details of a command.

ParameterDefinitions

object

ParameterDefinition

array<object>

The details of the custom parameters.

array<object>

The details of a custom parameter.

DefaultValue

string

The default value of the custom parameter.

https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm

Description

string

The description of the custom parameter.

云助手Agent安装包路径

Required

boolean

Specifies whether the custom parameter is required.

  • true: The parameter is required.

  • false: The parameter is not required.

Default value: false.

true

ParameterName

string

The name of the custom parameter.

DownloadUrl

PossibleValues

object

PossibleValue

array

An array of valid values for the enumerated parameter.

string

A valid value for an enumerated custom parameter.

"Linux","Windows"

PatternRegex

string

The regular expression that is used to validate the custom parameter.

^[a-zA-Z0-9_-]{4,32}$

Description

string

The description of the command.

testDescription

Category

string

The category of the public command.

“”

ResourceGroupId

string

The ID of the resource group to which the command belongs.

rg-123******

ParameterNames

object

ParameterName

array

The names of the custom parameters that are parsed from the CommandContent. If the command does not use custom parameters, an empty array is returned.

string

The name of a custom parameter.

['parameter1','parameter2']

Timeout

integer

The timeout period for the command to run, in seconds.

3600

Provider

string

The provider of the public command.

AlibabaCloud.ECS.GuestOS

Name

string

The name of the command.

testName

WorkingDir

string

The working directory of the command.

/home/

CommandContent

string

The content of the command. The content is Base64-encoded.

  • If ContentEncoding is set to PlainText, the original script content is returned.

  • If ContentEncoding is set to Base64, the Base64-encoded script content is returned.

Y2QgL3Jvb3Q=

Type

string

The type of the command.

RunShellScript

Version

integer

The version of the public command. Public commands that have the same Provider, name, and category are considered different versions of the same command. This parameter is not returned for custom commands.

1

InvokeTimes

integer

The number of times the command has been invoked.

2

CreationTime

string

The time at which the command was created.

2020-11-17T06:52Z

Launcher

string

The launcher of the script. The value cannot exceed 1 KB in size.

python3 -u {{ACS::ScriptFileName|Ext(".py")}}

Latest

boolean

Indicates whether the command is the latest version. Public commands that have the same Provider, name, and category are considered different versions of the same command. This parameter is not returned for custom commands.

true

EnableParameter

boolean

Indicates whether custom parameters are enabled for the command.

true

CommandId

string

The command ID.

c-hz01272yr52****

Tags

object

Tag

array<object>

The tags attached to the command.

object

A tag that is attached to the command.

TagKey

string

The tag key of the command.

owner

TagValue

string

The tag value of the command.

zhangsan

Examples

Success response

JSON format

{
  "PageSize": 10,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "PageNumber": 1,
  "TotalCount": 5,
  "NextToken": "AAAAAdDWBF2",
  "Commands": {
    "Command": [
      {
        "ParameterDefinitions": {
          "ParameterDefinition": [
            {
              "DefaultValue": "https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm",
              "Description": "云助手Agent安装包路径",
              "Required": true,
              "ParameterName": "DownloadUrl",
              "PossibleValues": {
                "PossibleValue": [
                  "\"Linux\",\"Windows\""
                ]
              },
              "PatternRegex": "^[a-zA-Z0-9_-]{4,32}$\u0000"
            }
          ]
        },
        "Description": "testDescription",
        "Category": "“”",
        "ResourceGroupId": "rg-123******",
        "ParameterNames": {
          "ParameterName": [
            "['parameter1','parameter2']"
          ]
        },
        "Timeout": 3600,
        "Provider": "AlibabaCloud.ECS.GuestOS",
        "Name": "testName",
        "WorkingDir": "/home/",
        "CommandContent": "Y2QgL3Jvb3Q=",
        "Type": "RunShellScript",
        "Version": 1,
        "InvokeTimes": 2,
        "CreationTime": "2020-11-17T06:52Z",
        "Launcher": "python3 -u {{ACS::ScriptFileName|Ext(\".py\")}}\n",
        "Latest": true,
        "EnableParameter": true,
        "CommandId": "c-hz01272yr52****",
        "Tags": {
          "Tag": [
            {
              "TagKey": "owner",
              "TagValue": "zhangsan"
            }
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 RegionId.ApiNotSupported The api is not supported in this region. The API operation cannot be called in the specified region. Check whether the specified RegionId parameter is valid.
400 NumberExceed.Tags The Tags parameter number is exceed. The number of tags exceeds the maximum limit.
400 Duplicate.TagKey The Tag.N.Key contain duplicate key. The specified tag key already exists. Tag keys must be unique.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. The specified Tag.N.Key parameter is invalid.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. The specified tag value is invalid.
400 MissingParameter.TagKey You must specify Tag.N.Key. The tag key is not specified.
400 InvalidParam.PageNumber The specified parameter is invalid.
400 InvalidParam.PageSize The specified parameter is invalid.
400 InvalidParameter.NextToken The specified parameter NextToken is not valid. The specified parameter NextToken is illegal.
400 InvalidParameter.MaxResults The specified parameter MaxResults is not valid. The specified parameter MaxResults is illegal.
500 InternalError.Dispatch An error occurred when you dispatched the request. An error occurred while the request is being sent. Try again later.
500 ServiceUnavailable The request has failed due to a temporary failure of the server.
500 InternalError The request processing has failed due to some unknown error.
403 Operation.Forbidden The operation is not permitted. The operation is not supported.
403 InvalidName.LengthLimitExceeded The length of the parameter Name exceeds the upper limit.
403 InvalidDescription.LengthLimitExceeded The length of the parameter Description exceeds the upper limit.
404 InvalidRegionId.NotFound The RegionId provided does not exist in our records. Region information error
404 InvalidCommandType.NotFound The specified parameter Type does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.