All Products
Search
Document Center

Elastic Compute Service:DescribeCommands

Last Updated:Aug 28, 2026

Queries Cloud Assistant commands that you manually created or public commands provided by Alibaba Cloud.

Operation description

Operation description

  • If you specify only the Action and RegionId parameters without specifying other request parameters, all active commands (CommandId) that you manually created are queried by default.

  • When querying the first page of results with a paged query, set only MaxResults to limit the number of entries returned. The NextToken value in the response serves as the token for querying subsequent pages. When querying subsequent pages, set the NextToken parameter to the NextToken value obtained from the previous response as the query token, and set MaxResults to limit the number of entries returned.

Settings: When performing paging, use NextToken and MaxResults for optimal results.

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 region ID. You can call DescribeRegions to query the most recent region list.

cn-hangzhou

Provider

string

No

The provider of the public command. Valid values:

  • If this parameter is not specified, all Cloud Assistant commands that you manually created are queried by default.

  • If this parameter is set to AlibabaCloud, all public commands provided by Alibaba Cloud are queried.

  • If this parameter is set to a specific public command provider, all public commands provided by that provider are queried. Examples:
    • If Provider=AlibabaCloud.ECS.GuestOS, public commands provided by AlibabaCloud.ECS.GuestOS are queried.

    • If Provider=AlibabaCloud.ECS.GuestOSDiagnose, public commands provided by AlibabaCloud.ECS.GuestOSDiagnose are queried.

AlibabaCloud

CommandId

string

No

The command ID.

c-hz01272yr52****

Name

string

No

The name of the command.

  • When the Provider parameter is specified parameter query public commands, fuzzy match is supported by default.

  • When the Provider parameter is not specified parameter query private commands, fuzzy match is supported. For example, enter command* to search for all commands whose names start with command, enter *command to search for all commands whose names end with command, or enter *command* to search for all commands whose names contain command.

testName

Description

string

No

The description of the command.

  • When the Provider parameter is specified parameter query public commands, fuzzy match is supported by default.

  • When the Provider parameter is not specified parameter query private commands, fuzzy match is supported. For example, enter test* to search for all commands whose descriptions start with test, enter *test to search for all commands whose descriptions end with test, or enter *test* to search for all commands whose descriptions contain test.

testDescription

Type

string

No

The type of the command. Valid values:

  • RunBatScript: Bat script that runs on Windows instances.

  • RunPowerShellScript: PowerShell script that runs on Windows instances.

  • RunShellScript: Shell script that runs on Linux instances.

RunShellScript

ContentEncoding

string

No

The encoding mode of the CommandContent and Output fields in the response. Valid values:

  • PlainText: Returns the original script content and output.

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

Default value: Base64.

PlainText

PageNumber

integer

No

Note

This parameter is about to go offline. Use NextToken and MaxResults to complete paged query operations. For paging, use NextToken and MaxResults instead.

1

PageSize

integer

No

Note

This parameter is about to go offline. Use NextToken and MaxResults to complete paged query operations. For paging, use NextToken and MaxResults instead.

10

MaxResults

integer

No

The maximum number of entries per page for a paged query.

Maximum value: 50.

Default value: 10.

10

NextToken

string

No

The pagination token. Set this parameter to the NextToken value returned in the previous API call.

AAAAAdDWBF2

Latest

boolean

No

Specifies whether to query only the latest version of public commands when the query results include public commands. This parameter does not affect the query of private commands.

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

  • false: Queries 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.

object

No

The tag object.

Value

string

No

The tag value of the command. Valid values of N: 1 to 20. The tag value can be an empty string.

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

TestValue

Key

string

No

The tag key of the command. Valid values of N: 1 to 20. The tag key cannot be an empty string.

If you use a single tag to filter resources, the resource count with this tag cannot exceed 1,000. If you use multiple tags to filter resources, the resource count with all specified tags attached cannot exceed 1,000. If the resource count exceeds 1,000, use the ListTagResources operation to query resources.

The tag key can be up to 64 characters in length and cannot start with aliyun or acs:, or 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 of the command list.

1

TotalCount

integer

The total number of commands.

5

NextToken

string

The pagination token returned in this call.

AAAAAdDWBF2

Commands

object

Command

array<object>

The command dataset.

array<object>

The command object.

ParameterDefinitions

object

ParameterDefinition

array<object>

The list of custom parameter details.

array<object>

The custom parameter object.

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.

Cloud Assistant Agent installation package path

Required

boolean

Indicates whether the custom parameter is required.

  • true: Required.

  • false: Not required.

Default value: false.

true

ParameterName

string

The name of the custom parameter.

DownloadUrl

PossibleValues

object

PossibleValue

array

The list of possible values for the enumeration-type custom parameter.

string

The possible value for the enumeration-type custom parameter.

"Linux","Windows"

PatternRegex

string

The regular expression rule for 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 list of custom parameter names parsed from the CommandContent when the command was created, returned as a list. If the custom parameter feature is not used, an empty list is returned.

string

The custom parameter name.

['parameter1','parameter2']

Timeout

integer

The timeout period. Unit: seconds.

3600

Provider

string

The provider of the public command.

AlibabaCloud.ECS.GuestOS

Name

string

The name of the command.

testName

WorkingDir

string

The execution path.

/home/

CommandContent

string

The command content, transmitted in Base64 encoding.

  • 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. If multiple commands belong to the same Provider and have the same name and category, these commands are different versions of the same command. This value is not returned for Cloud Assistant commands that you manually created.

1

InvokeTimes

integer

The number of tasks created by using this command.

2

CreationTime

string

The time when the command was created.

2020-11-17T06:52Z

Launcher

string

The launcher for script execution. The launcher cannot exceed 1 KB in length.

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

Latest

boolean

Indicates whether the public command is the latest version. If multiple commands belong to the same Provider and have the same name and category, these commands are different versions of the same command. This value is not returned for Cloud Assistant commands that you manually created.

true

EnableParameter

boolean

Indicates whether the custom parameter feature is enabled for the command.

true

CommandId

string

The command ID.

c-hz01272yr52****

Tags

object

Tag

array<object>

The list of tags for the command.

object

The tag information object of 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": "Cloud Assistant Agent installation package path",
              "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.
404 InvalidCommandId.NotFound The specified commandId does not exist

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.