All Products
Search
Document Center

Simple Application Server:DescribeCommandInvocations

Last Updated:Sep 08, 2026

Queries the list and status of commands run by Cloud Assistant.

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

swas-open:DescribeCommandInvocations

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID. You can call ListRegions to query available regions.

cn-hangzhou

InstanceId

string

No

The instance ID of the simple application server.

ace0706b2ac4454d984295a94213****

CommandId

string

No

The command ID. You can call DescribeCommands to query all available command IDs.

c-sh02yh0932w****

InvokeId

string

No

The command execution ID.

t-hz02p9545t6****

CommandName

string

No

The command name. If the InstanceId parameter is also specified, this parameter does not take effect.

testName

InvocationStatus

string

No

The overall execution status of the command. The overall execution status depends on the common execution status across all instances in this invocation. Valid values:

  • Pending: The system is validating or sending the command. If the command execution status on at least one instance is Pending, the overall execution status is Pending.

  • Running: The command is running on instances. If the command execution status on at least one instance is Running, the overall execution status is Running.

  • Success: The command execution status on each instance is Stopped or Success, and the command execution status on at least one instance is Success. In this case, the overall execution status is Success.
    • One-time task: The command execution is complete and the exit code is 0.

  • Failed: The command execution status on each instance is Stopped or Failed. In this case, the overall execution status is Failed. The overall execution status is Failed when the command execution status on an instance is one or more of the following values:
    • Command validation failed (Invalid).

    • Command sending failed (Aborted).

    • Command execution is complete but the exit code is not 0 (Failed).

    • Command execution timed out (Timeout).

    • Command execution encountered an exception (Error).

  • Stopping: The task is being stopped. If the command execution status on at least one instance is Stopping, the overall execution status is Stopping.

  • Stopped: The task is stopped. If the command execution status on all instances is Stopped, the overall execution status is Stopped. The overall execution status is Stopped when the command execution status on an instance is one of the following values:
    • Task canceled (Cancelled).

    • Task terminated (Terminated).

  • PartialFailed: The command execution succeeded on some instances and failed on others. If the command execution status on each instance is Success, Failed, or Stopped, the overall execution status is PartialFailed.

Note

The InvokeStatus response parameter has a similar meaning, but we recommend that you check the value of this parameter.

Success

CommandType

string

No

The command type. Valid values:

  • RunBatScript: Bat command for Windows instances.

  • RunPowerShellScript: PowerShell command for Windows instances.

  • RunShellScript: Shell command for Linux instances.

RunPowerShellScript

PageNumber

string

No

The page number. Minimum value: 1. Default value: 1.

1

PageSize

string

No

The number of entries per page for a paged query.

Maximum value: 50.

Default value: 10.

10

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

30637AD6-D977-4833-A54C-CC89483E****

TotalCount

integer

The total number of entries.

10

PageNumber

integer

The page number of the query result.

1

PageSize

integer

The number of entries per page settings for a paged query. This is the paging size.

10

CommandInvocations

array<object>

The list of command executions.

array<object>

The command execution information struct.

InvokeId

string

The command execution ID.

t-hz0373jyzxt****

CreationTime

string

The time when the command was created, in the format of YYYY-MM-DDThh:mm:ss.

2023-04-27T10:11:58

CommandId

string

The command ID.

c-hy0338xh28r****

InvocationStatus

string

The execution status of the command. Valid values:

  • Pending: The system is validating or sending the command.

  • Invalid: The specified command type or parameter is invalid.

  • Aborted: Failed to send the command to the instance. The instance must be running and the command must be delivered within 1 minute.

  • Running: The command is running on the instance.

  • Success: The command execution is complete and the exit code is 0.

  • Failed: The command execution is complete and the exit code is not 0.

  • Error: An exception occurred during command execution and the command cannot continue.

  • Timeout: The command execution timed out.

  • Cancelled: The command execution action has been canceled and the command was never started.

  • Stopping: The command execution is being stopped.

  • Terminated: The command was terminated during execution.

Success

CommandName

string

The command name.

testCommandName

CommandType

string

The command type.

RunShellScript

CommandDescription

string

The command description.

testDescription

Username

string

The username used to run the command.

root

WorkingDir

string

The path in which the command was executed.

c:\wwwroot

Timeout

integer

The timeout period, in seconds.

60

CommandContent

string

The command content.

echo 123

Parameters

string

The custom parameters included in the command. If no parameters exist, the default value is {}.

{}

InvokeInstances

array<object>

The list of target instances for execution.

object

The target instance information struct.

InstanceId

string

The instance ID of the simple application server.

2445f4aecdac4b71ba2c7e3a7ccf****

StartTime

string

The time when the command started running on the instance. The time is displayed in UTC (Z) in the format of YYYY-MM-DDThh:mm:ssZ.

2023-05-09T03:32:24Z

FinishTime

string

The time when the command process ended. The time is displayed in UTC (Z) in the format of YYYY-MM-DDThh:mm:ssZ.

2023-04-03T02:42:29Z

InvocationStatus

string

The command execution status on a single instance. Valid values:

  • Pending: The system is validating or sending the command.

  • Invalid: The specified command type or parameter is invalid.

  • Aborted: Failed to send the command to the instance. The instance must be running and the command must be delivered within 1 minute.

  • Running: The command is running on the instance.

  • Success:
    • One-time task: The command execution is complete and the exit code is 0.

    • Scheduled task: The last execution succeeded with an exit code of 0, and the specified schedule has ended.

  • Failed:
    • One-time task: The command execution is complete and the exit code is not 0.

    • Scheduled task: The last execution succeeded with an exit code that is not 0, and the specified schedule will be aborted.

  • Error: An exception occurred during command execution and the command cannot continue.

  • Timeout: The command execution timed out.

  • Cancelled: The command execution action has been canceled and the command was never started.

  • Stopping: The task is being stopped.

  • Terminated: The command was terminated during execution.

Running

Output

string

The output information of the command execution.

OutputMsg

ExitCode

integer

The exit code of the command.

  • For Linux instances, this is the exit code of the Shell command.

  • For Windows instances, this is the exit code of the Bat or PowerShell command.

0

ErrorInfo

string

The details of the command delivery failure or execution failure. Valid values:

  • Empty: The command executed normally.

  • the specified instance does not exists: The specified instance does not exist or has been released.

  • the instance has released when create task: The instance was released during command execution.

  • the instance is not running when create task: The instance was not running when the command was executed.

  • the command is not applicable: The command is not applicable to the specified instance.

  • the specified account does not exists: The specified account does not exist.

  • the specified directory does not exists: The specified directory does not exist.

  • the cron job expression is invalid: The specified cron expression is invalid.

  • the aliyun service is not running on the instance: The Cloud Assistant Agent is not running.

  • the aliyun service in the instance does not response: The Cloud Assistant Agent is not responding.

  • the aliyun service in the instance is upgrading now: The Cloud Assistant Agent is being upgraded.

  • the aliyun service in the instance need upgrade: The Cloud Assistant Agent needs to be upgraded.

  • the command delivery has been timeout: Command delivery timed out.

  • the command execution has been timeout: Command execution timed out.

  • the command execution got an exception: An exception occurred during command execution.

  • the command execution has been interrupted: Command execution was interrupted.

  • the command execution exit code is not zero: Command execution completed with a non-zero exit code.

the specified instance does not exists

ErrorCode

string

The error code for the command delivery failure or execution failure. Valid values:

  • Empty: The command executed normally.

  • InstanceNotExists: The specified instance does not exist or has been released.

  • InstanceReleased: The instance was released during command execution.

  • InstanceNotRunning: The instance was not running when the command was executed.

  • CommandNotApplicable: The command is not applicable to the specified instance.

  • AccountNotExists: The specified account does not exist.

  • DirectoryNotExists: The specified directory does not exist.

  • BadCronExpression: The specified cron expression is invalid.

  • ClientNotRunning: The Cloud Assistant Agent is not running.

  • ClientNotResponse: The Cloud Assistant Agent is not responding.

  • ClientIsUpgrading: The Cloud Assistant Agent is being upgraded.

  • ClientNeedUpgrade: The Cloud Assistant Agent needs to be upgraded.

  • DeliveryTimeout: Command delivery timed out.

  • ExecutionTimeout: Command execution timed out.

  • ExecutionException: An exception occurred during command execution.

  • ExecutionInterrupted: Command execution was interrupted.

  • ExitCodeNonzero: Command execution completed with a non-zero exit code.

InstanceNotExists

Examples

Success response

JSON format

{
  "RequestId": "30637AD6-D977-4833-A54C-CC89483E****",
  "TotalCount": 10,
  "PageNumber": 1,
  "PageSize": 10,
  "CommandInvocations": [
    {
      "InvokeId": "t-hz0373jyzxt****",
      "CreationTime": "2023-04-27T10:11:58",
      "CommandId": "c-hy0338xh28r****",
      "InvocationStatus": "Success",
      "CommandName": "testCommandName",
      "CommandType": "RunShellScript",
      "CommandDescription": "testDescription",
      "Username": "root",
      "WorkingDir": "c:\\wwwroot",
      "Timeout": 60,
      "CommandContent": "echo 123",
      "Parameters": "{}",
      "InvokeInstances": [
        {
          "InstanceId": "2445f4aecdac4b71ba2c7e3a7ccf****",
          "StartTime": "2023-05-09T03:32:24Z",
          "FinishTime": "2023-04-03T02:42:29Z",
          "InvocationStatus": "Running",
          "Output": "OutputMsg",
          "ExitCode": 0,
          "ErrorInfo": "the specified instance does not exists",
          "ErrorCode": "InstanceNotExists"
        }
      ]
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.