DescribeInvocationResults

更新时间:
复制 MD 格式

$.parameters[11].schema.items.properties.Value.example

Operation description

API Guide

  • After you execute a command, it does not necessarily mean that the command was successfully executed or produced the expected effect. You must use this API to check the actual execution results, and the actual output takes precedence.

  • You can query execution information from the last four weeks, with a maximum retention limit of 100,000 records.

  • You can obtain job results through management event subscription for Cloud Assistant task status, which avoids frequent polling and improves efficiency.

  • When performing a paged query on the home page, you only need to set MaxResults to limit the number of returned entries. The NextToken in the return result serves as the credential for querying subsequent pages. When querying subsequent pages, set the NextToken parameter to the NextToken value obtained from the previous response as the query credential, and set MaxResults to limit the number of returned entries.

  • Differences between DescribeInvocations and DescribeInvocationResults:

    • When a single RunCommand/InvokeCommand invocation targets multiple instances:
      • DescribeInvocations provides the execution status on each instance and an aggregation status across all instances.

      • DescribeInvocationResults only provides individual execution statuses per instance, without aggregated multi-instance status.

    • When a single RunCommand/InvokeCommand invocation targets one instance:
      • There is little difference between DescribeInvocations and DescribeInvocationResults, and they can fully replace each other.

    • When you need to view the execution history of scheduled (periodic) tasks or automatic startup tasks (RepeatMode=Period, EveryReboot), only DescribeInvocationResults can retrieve historical execution records (by specifying IncludeHistory=true). In contrast, DescribeInvocations only returns the latest task status.

    • When you need to view the command content or 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

$.parameters[11].schema.items.description

cn-hangzhou

ResourceGroupId

string

No

$.parameters[11].schema.items.example

rg-bp67acfmxazb4p****

RegionId

string

Yes

$.parameters[11].schema.items.description

cn-hangzhou

InvokeId

string

No

$.parameters[11].schema.items.enumValueTitles

t-hz0jdfwd9f****

InstanceId

string

No

$.parameters[11].schema.description

i-bp1i7gg30r52z2em****

CommandId

string

No

$.parameters[11].schema.example

c-hz0jdfwcsr****

InvokeRecordStatus

string

No

$.parameters[11].schema.enumValueTitles

Running

IncludeHistory

boolean

No

{ "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE*****", "Invocation" : { "InvocationResults" : { "InvocationResult" : [ { "Dropped" : 0, "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", "Output" : "MTU6MzA6MDEK", "CommandId" : "c-hz0jdfwcsr****", "ErrorCode" : "InstanceNotExists", "InvokeId" : "t-hz0jdfwd9f****", "StopTime" : "2020-01-19T09:15:47Z", "ContainerId":"ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****", "ContainerName":"test-container",
"Tags": [ { "TagKey": "owner", "TagValue": "zhangsan" } ] } ] }, "TotalCount" : 1, "PageSize" : 1, "PageNumber" : 1 } }

false

ContentEncoding

string

No

473469C7-AA6F-4DC5-B3DB-A3DC0DE***** 0 Success i-bp1i7gg30r52z2em**** 0 the specified instance does not exists 2019-12-20T06:15:55Z 0 Running 2019-12-20T06:15:56Z MTU6MzA6MDEK c-hz0jdfwcsr**** InstanceNotExists t-hz0jdfwd9f**** 2020-01-19T09:15:47Z ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea**** test-container owner zhangsan 1 1 1

PlainText

PageNumber

integer

No

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

1

PageSize

integer

No

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

1

MaxResults

integer

No

FEATUREecsXZ3H4M

10

NextToken

string

No

dubbo

AAAAAdDWBF2

Tag

array<object>

No

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

object

No

The ID of the resource group. After you set this parameter, command execution results in the specified resource group are queried.

Value

string

No

The ID of the command task. You can call the DescribeInvocations operation to query the IDs of all command tasks.

TestValue

Key

string

No

The ID of the instance.

TestKey

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the command.

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

Invocation

object

The execution status of the command task. Valid values:

  • Running:

    • Scheduled task: Before you stop the scheduled execution of the command, the execution state is always Running.

    • One-time task: If the command is being run on instances, the execution state is Running.

  • Finished:

    • Scheduled task: The execution state can never be Finished.

    • One-time task: The execution is complete on all instances, or the execution is stopped on some instances and is complete on the other instances.

  • Success:

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

    • Scheduled task: The last execution is complete, the exit code is 0, and the specified period ends.

  • Failed:

    • Scheduled task: The execution state can never be Failed.

    • One-time task: The execution fails on all instances.

  • PartialFailed:

    • Scheduled task: The execution state can never be PartialFailed.

    • One-time task: The execution fails on some instances.

  • Stopped: The task is stopped.

  • Stopping: The task is being stopped.

PageSize

integer

Specifies whether to return the results of historical scheduled executions. Valid values:

  • true: returns the results of historical scheduled executions. If you set this parameter to true, you must set InvokeId to the ID of a task that is run on a schedule (RepeatMode set to Period) or on each system startup (RepeatMode set to EveryReboot).

  • false: does not return the results of historical scheduled executions.

Default value: false.

1

PageNumber

integer

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

  • PlainText: returns the original command content and command output.

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

Default value: Base64.

1

TotalCount

integer

Note

This parameter will be removed in the future. We recommend that you use NextToken and MaxResults for a paged query.

1

NextToken

string

Note

This parameter will be removed in the future. We recommend that you use NextToken and MaxResults for a paged query.

AAAAAdDWBF2

InvocationResults

object

InvocationResult

array<object>

The maximum number of entries per page.

Valid values: 1 to 50.

Default value: 10.

array<object>

Dropped

integer

The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.

0

OssOutputDelivery

string

The tags of the command task.

oss://testBucket/testPrefix

InvocationStatus

string

The tag of the command task.

Success

InstanceId

string

The value of tag N of the command task. 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://.

i-bp1i7gg30r52z2em****

ExitCode

integer

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

If a single tag is specified to query resources, up to 1,000 resources that have this tag added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags added can be displayed in the response. To query more than 1,000 resources that have specified tags added, call the ListTagResources operation.

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

0

ErrorInfo

string

The ID of the request.

the specified instance does not exists

StartTime

string

Details about the execution results.

2019-12-20T06:15:55Z

Repeats

integer

The number of entries per page.

0

InvokeRecordStatus

string

The page number.

Running

FinishedTime

string

The total number of the commands.

2019-12-20T06:15:56Z

OssOutputUri

string

A pagination token. It can be used in the next request to retrieve a new page of results.

oss://testBucket/testPrefix/output.txt

OssOutputStatus

string

The execution results.

Finished

OssOutputErrorCode

string

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

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

  • CloudAssistant.ClientNeedUpgrade: The Cloud Assistant version does not support delivery. For Linux instances, the Cloud Assistant version must be later than 2.2.4.1007. For Windows instances, the Cloud Assistant version must be later than 2.1.4.1007.

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

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

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

  • OSS.InvalidObjectName: The object name is invalid. This includes cases where no object name is specified, the object name exceeds the length limit, or the specified object name is invalid.

CloudAssistant.UnsupportedInvocationStatus

OssOutputErrorInfo

string

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

The invocation status does not support output delivery.

Username

string

The size of the Output text that was truncated and discarded because the Output value exceeded 24 KB in size.

test

ContainerId

string

Command to execute the Output OSS delivery configuration.

ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****

ContainerName

string

The execution status on a single instance. Valid values:

  • Pending: The command is being verified or sent.

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

  • Aborted: The command failed to be sent to the instance. To send a command to an instance, make sure that the instance is in the Running state and the command can be sent to the instance within 1 minute.

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

  • Success:

    • One-time task: The execution was complete, and the exit code was 0.

    • Scheduled task: The last execution was complete, the exit code was 0, and the specified period ended.

  • Failed:

    • One-time task: The execution was complete, but the exit code was not 0.

    • Scheduled task: The last execution was complete, but the exit code was not 0. The specified period was about to end.

  • Error: The execution cannot proceed due to an exception.

  • Timeout: The execution timed out.

  • Cancelled: The execution was canceled before it started.

  • Stopping: The command task is being stopped.

  • Terminated: The execution was terminated before completion.

  • Scheduled:

    • One-time task: The execution state can never be Scheduled.

    • Scheduled task: The command is waiting to be run.

test-container

Output

string

The instance ID.

MTU6MzA6MDEK

Launcher

string

The exit code of the command task.

  • For Linux instances, the value is the exit code of the shell command.

  • For Windows instances, the value is the exit code of the batch or PowerShell command.

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

CommandId

string

The error message returned when the command failed to be sent or run. Valid values:

  • If this parameter is empty, the command was run as expected.

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

  • The specified instance does not exist.

  • The specified instance was released during task execution.

  • The specified instance was not running during task execution.

  • The OS type of the instance does not support the specified command type.

  • The specified account does not exist.

  • The specified directory does not exist.

  • The cron expression is invalid.

  • The aliyun service is not running on the instance.

  • The aliyun service in the instance does not response.

  • The aliyun service in the instance is upgrading during task execution.

  • The aliyun service in the instance need to be upgraded to at least version to support the feature. indicates the earliest version that supports the feature. indicates the name of the feature.

  • The command delivery has been timeout.

  • The command execution has been timeout.

  • The command execution got an exception.

  • The command execution exit code is not zero.

  • The specified instance was released during task execution.

c-hz0jdfwcsr****

ErrorCode

string

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

InstanceNotExists

InvokeId

string

The number of times that the command was run on the instance.

  • If the command is set to run only once, the value is 0 or 1.

  • If the command is set to run on a schedule, the value is the number of times that the command has been run on the instance.

t-hz0jdfwd9f****

TerminationMode

string

The execution status of the command. Valid values:

  • Running:

    • Scheduled task: Before you stop the scheduled execution of the command, the execution state is always Running.

    • One-time task: If the command is being run on instances, the execution state is Running.

  • Finished:

    • Scheduled task: The execution state can never be Finished.

    • One-time task: The execution was complete on all instances, or the execution was stopped on some instances and was complete on the other instances.

  • Failed:

    • Scheduled task: The execution state can never be Failed.

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

  • PartialFailed:

    • Scheduled task: The execution state can never be PartialFailed.

    • One-time task: The execution failed on some instances.

  • Stopped: The task was stopped.

  • Stopping: The task is being stopped.

ProcessTree

Tags

object

Tag

array<object>

The time when the command task was completed. If the command task times out, the end time is equal to the start time of the command task specified by StartTime plus the timeout period specified by Timeout.

object

The command execution Output delivers the object URI to OSS. This field is an empty string when the delivery fails or is in progress.

TagKey

string

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

  • InProgress: The delivery is in progress.

  • Finished: The delivery is complete.

  • Failed: The delivery failed.

owner

TagValue

string

The username used to run the command on the instance.

zhangsan

StopTime

string

root

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.