All Products
Search
Document Center

Elastic Compute Service:DescribeInvocationResults

Last Updated:Jun 26, 2026

Queries the execution results of one or more Cloud Assistant commands, which are the actual execution results on ECS instances.

Operation description

Operation description

  • After you run a command, the command is not guaranteed to succeed or produce the expected results. Call this operation to view the actual execution results based on the actual output.

  • You can query execution information from the last 30 days. A maximum of 10,000 entries of execution information can be retained.

  • You can use Cloud Assistant task status event subscription to obtain task results through events, which avoids frequent polling and improves efficiency.

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

  • Differences between DescribeInvocations and DescribeInvocationResults:

    • When a single RunCommand/InvokeCommand call specifies multiple instances:
      • DescribeInvocations returns the execution status on each instance and the aggregated status across all instances.

      • DescribeInvocationResults returns only the individual execution status on each instance, without the aggregated status across instances.

    • When a single RunCommand/InvokeCommand call specifies one instance:
      • DescribeInvocations and DescribeInvocationResults are largely interchangeable.

    • When you want to view the execution history of scheduled (periodic) tasks or tasks that run at each system startup (RepeatMode=Period, EveryReboot), only DescribeInvocationResults can return historical execution records (you must specify IncludeHistory=true). DescribeInvocations returns only the latest task status.

    • When you want to view the command content and parameters, only DescribeInvocations returns CommandContent.

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:DescribeInvocationResults

get

Command

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

Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

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

ResourceGroupId

string

No

The resource group ID of the command execution. After you specify this parameter, the resource group ID must also be specified when you run the command. This parameter filters the corresponding command execution results.

rg-bp67acfmxazb4p****

RegionId

string

Yes

The region ID. You can call DescribeRegions to query the most recent region list.

cn-hangzhou

InvokeId

string

No

The command execution ID. You can call DescribeInvocations to query the InvokeId.

t-hz0jdfwd9f****

InstanceId

string

No

The instance ID.

i-bp1i7gg30r52z2em****

CommandId

string

No

The command ID.

c-hz0jdfwcsr****

InvokeRecordStatus

string

No

The execution status of the command. Valid values:

  • Running: The command is running.
    • Scheduled execution: The execution status remains running until you manually stop the scheduled command.

    • One-time execution: The overall execution status is running as long as any command process is running.

  • Finished: The command execution is complete.
    • Scheduled execution: The command process cannot have a status of finished.

    • One-time execution: All instances have completed execution, or you manually stopped the command process on some instances and the remaining instances have completed execution.

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

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

  • Failed: The command execution failed.
    • Scheduled execution: The command process cannot have a status of failed.

    • One-time execution: The command execution failed on all instances.

  • PartialFailed: The command execution partially failed.
    • Scheduled execution: The command process cannot have a status of partially failed.

    • One-time execution: The command execution failed on some instances, so the overall execution status is partially failed.

  • Stopped: The command execution has been stopped.

  • Stopping: The command execution is being stopped.

Running

IncludeHistory

boolean

No

Specifies whether to return the execution history of scheduled commands. Valid values:

  • true: Returns the execution results of scheduled commands. When this parameter is set to true, the InvokeId parameter is required and must be the execution ID of a scheduled command (RepeatMode is Period) or a command that runs at each system startup (RepeatMode is EveryReboot).

  • false: Does not return the execution history.

Default value: false.

false

ContentEncoding

string

No

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

  • PlainText: Returns the original command content and output.

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

Default value: Base64.

PlainText

PageNumber

integer

No

Note

This parameter is about to go offline. Use NextToken and MaxResults to complete paging query operations.

1

PageSize

integer

No

Note

This parameter is about to go offline. Use NextToken and MaxResults to complete paging query operations.

1

MaxResults

integer

No

The maximum number of entries per page in a paging 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

Tag

array<object>

No

The tags.

object

No

The tags.

Value

string

No

The tag value of the command execution. 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 execution. 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 number of resources with this tag cannot exceed 1,000. If you use multiple tags to filter resources, the number of resources with all specified tags attached cannot exceed 1,000. If the number of resources exceeds 1,000, call ListTagResources to execute the query.

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

TestKey

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

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

Invocation

object

The collection of command execution results.

PageSize

integer

The number of entries per page. This value is the PageSize value specified in the paging query settings.

1

PageNumber

integer

The current page number.

1

TotalCount

integer

The total number of commands.

1

NextToken

string

The pagination token returned in this call.

AAAAAdDWBF2

InvocationResults

object

InvocationResult

array<object>

The command execution result set.

array<object>

Dropped

integer

The length of the truncated and discarded text after the text in the Output field exceeds 24 KB.

0

OssOutputDelivery

string

The OSS delivery configuration for the command execution output.

oss://testBucket/testPrefix

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 deliverable within 1 minute.

  • Running: The command is being executed on the instance.

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

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

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

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

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

  • Timeout: The command execution timed out.

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

  • Stopping: The command execution is being stopped.

  • Terminated: The command was terminated during execution.

  • Scheduled:
    • One-time execution: Not applicable. This value does not occur.

    • Scheduled execution: Waiting for execution.

Success

InstanceId

string

The instance ID.

i-bp1i7gg30r52z2em****

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 ran normally.

  • The security group rules denied access to the aliyun service: The security group rules denied access to the Cloud Assistant service.

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

  • The specified instance was released during task execution: The instance was released during command execution.

  • The specified instance was not running during task execution: The instance was not running when the command started to be executed.

  • The OS type of the instance does not support the specified command type: The command is not applicable to the specified instance.

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

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

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

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

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

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

  • The aliyun service in the instance need to be upgraded to at least version <version> to support the <feature> feature: Cloud Assistant Agent needs to be upgraded. <version> is the minimum supported version for the feature, and <feature> is the specific feature.

  • The command delivery has been timeout: The command delivery timed out.

  • The command execution has been timeout: The command execution timed out.

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

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

  • The specified instance was released during task execution: The instance was released during file delivery.

the specified instance does not exists

StartTime

string

The time when the command started to be executed on the instance.

2019-12-20T06:15:55Z

Repeats

integer

The number of times the command was executed on the instance.

  • If the execution mode is one-time execution, the value is 0 or 1.

  • If the execution mode is scheduled execution, the value is the number of times the command has been executed.

0

InvokeRecordStatus

string

The execution status of the command. Valid values:

  • Running: The command is running.
    • Scheduled execution: The execution status remains running until you manually stop the scheduled command.

    • One-time execution: The overall execution status is running as long as any command process is running.

  • Finished: The command execution is complete.
    • Scheduled execution: The command process cannot have a status of finished.

    • One-time execution: All instances have completed execution, or you manually stopped the command process on some instances and the remaining instances have completed execution.

  • Failed: The command execution failed.
    • Scheduled execution: The command process cannot have a status of failed.

    • One-time execution: All instances failed to execute the command.

  • PartialFailed: The command execution partially failed.
    • Scheduled execution: The command process cannot have a status of partially failed.

    • One-time execution: Some instances have failed command processes, so the overall execution status is partially failed.

  • Stopped: The command execution has been stopped.

  • Stopping: The command execution is being stopped.

Running

FinishedTime

string

The time when the command execution was complete. If the command execution times out, the completion time is calculated as StartTime plus the timeout period Timeout.

2019-12-20T06:15:56Z

OssOutputUri

string

The URI of the file in OSS to which the command execution output is delivered. This field is an empty string if the delivery is in progress or has failed.

oss://testBucket/testPrefix/output.txt

OssOutputStatus

string

The delivery status of the command execution output. Valid values:

  • InProgress: The delivery is in progress.

  • Finished: The delivery is complete.

  • Failed: The delivery failed.

Finished

OssOutputErrorCode

string

The error code returned when the delivery fails. This field is returned only when OssOutputStatus is Failed. Valid values:

  • CloudAssistant.UnsupportedInvocationStatus: The task status does not support delivery.

  • CloudAssistant.ClientNeedUpgrade: The Cloud Assistant Agent version does not support delivery. The Cloud Assistant Agent version must be later than 2.2.4.1007 for Linux instances and later than 2.1.4.1007 for Windows instances.

  • OSS.AccessDenied: The user does not have access permissions on the specified bucket.

  • OSS.NoSuchBucket: The specified bucket does not exist.

  • OSS.FileImmutable: The data in the bucket is in protection status.

  • OSS.InvalidObjectName: The object name is invalid. The object name is not specified, exceeds the length limit, or is invalid.

CloudAssistant.UnsupportedInvocationStatus

OssOutputErrorInfo

string

The error details returned when the delivery fails. This field is returned only when OssOutputStatus is Failed.

The invocation status does not support output delivery.

Username

string

The username used to execute the command on the ECS instance.

test

ContainerId

string

The container ID.

ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****

ContainerName

string

The container name.

test-container

Output

string

The output of the command execution.

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

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

MTU6MzA6MDEK

Launcher

string

The bootstrap program for script execution. The value cannot exceed 1 KB in length.

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

CommandId

string

The command ID.

c-hz0jdfwcsr****

ErrorCode

string

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

  • Empty: The command ran normally.

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

  • InstanceReleased: The instance was released during concurrent execution.

  • InstanceNotRunning: The instance was not running during concurrent execution.

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

  • AccountNotExists: The specified username for concurrent execution does not exist.

  • DirectoryNotExists: The specified directory does not exist.

  • BadCronExpression: The specified cron expression is invalid.

  • ClientNotRunning: Cloud Assistant Agent is not running.

  • ClientNotResponse: Cloud Assistant Agent is not responding.

  • ClientIsUpgrading: Cloud Assistant Agent is being upgraded.

  • ClientNeedUpgrade: Cloud Assistant Agent needs to be upgraded.

  • DeliveryTimeout: The command delivery timed out.

  • ExecutionTimeout: The concurrent execution timed out.

  • ExecutionException: An exception occurred during concurrent execution.

  • ExecutionInterrupted: The concurrent execution was interrupted.

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

  • SecurityGroupRuleDenied: The security group rules denied access to the Cloud Assistant service.

  • TaskConcurrencyLimit: The number of concurrent task executions exceeded the maximum quota.

InstanceNotExists

InvokeId

string

The command execution ID.

t-hz0jdfwd9f****

TerminationMode

string

The mode used when the task is stopped (manually stopped or interrupted due to timeout). Valid values:

  • Process: Stops the current script process.

  • ProcessTree: Stops the current process tree (the collection of the script process and all child processes it created).

ProcessTree

Tags

object

Tag

array<object>

The tag information of the command execution.

object

The tag information of the command execution.

TagKey

string

The tag key of the command execution.

owner

TagValue

string

The tag value of the command execution.

zhangsan

StopTime

string

The time when StopInvocation was called to stop the command execution.

2020-01-19T09:15:47Z

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE*****",
  "Invocation": {
    "PageSize": 1,
    "PageNumber": 1,
    "TotalCount": 1,
    "NextToken": "AAAAAdDWBF2",
    "InvocationResults": {
      "InvocationResult": [
        {
          "Dropped": 0,
          "OssOutputDelivery": "oss://testBucket/testPrefix",
          "InvocationStatus": "Success",
          "InstanceId": "i-bp1i7gg30r52z2em****",
          "ExitCode": 0,
          "ErrorInfo": "the specified instance does not exists",
          "StartTime": "2019-12-20T06:15:55Z",
          "Repeats": 0,
          "InvokeRecordStatus": "Running",
          "FinishedTime": "2019-12-20T06:15:56Z",
          "OssOutputUri": "oss://testBucket/testPrefix/output.txt",
          "OssOutputStatus": "Finished",
          "OssOutputErrorCode": "CloudAssistant.UnsupportedInvocationStatus",
          "OssOutputErrorInfo": "The invocation status does not support output delivery.",
          "Username": "test",
          "ContainerId": "ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****",
          "ContainerName": "test-container",
          "Output": "MTU6MzA6MDEK",
          "Launcher": "python3 -u {{ACS::ScriptFileName|Ext(\".py\")}}",
          "CommandId": "c-hz0jdfwcsr****",
          "ErrorCode": "InstanceNotExists",
          "InvokeId": "t-hz0jdfwd9f****",
          "TerminationMode": "ProcessTree",
          "Tags": {
            "Tag": [
              {
                "TagKey": "owner",
                "TagValue": "zhangsan"
              }
            ]
          },
          "StopTime": "2020-01-19T09:15:47Z"
        }
      ]
    }
  }
}

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.
404 InvalidRegionId.NotFound The RegionId provided does not exist in our records. Region information error

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.