All Products
Search
Document Center

Elastic Compute Service:DescribeInvocations

Last Updated:Mar 19, 2024

Queries the execution list and states of Cloud Assistant commands.

Operation description

  • After you run a command, the command may not succeed or return the expected result. You can call this operation to query the execution result.
  • You can query information about command executions within the last four weeks. A maximum of 100,000 entries of execution information can be retained.
    • Method 1: During a paged query, when you call the DescribeInvocations operation to retrieve the first page of results, set MaxResults to specify the maximum number of entries to return in the call. The return value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results. When you call the DescribeInvocations operation to retrieve a new page of results, set NextToken to the NextToken value returned in the previous call and set MaxResults to specify the maximum number of entries to return in this call.
    • Method 2: Use PageSize to specify the number of entries to return on each page, and then use PageNumber to specify the number of the page to return. You can use only one of the preceding methods. If you specify MaxResults or NextToken, the PageSize and PageNumber request parameters do not take effect and the TotalCount response parameter is invalid.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
ResourceGroupIdstringNo

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

rg-bp67acfmxazb4p****
InvokeIdstringNo

The command task ID.

t-hz0jdfwd9f****
CommandIdstringNo

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

c-hz0jdfwcsr****
CommandNamestringNo

The command name.

CommandTestName
CommandTypestringNo

The command type. If this parameter and InstanceId are both specified, this parameter does not take effect.

RunShellScript
TimedbooleanNo

Specifies whether to query commands that are to be automatically run. Valid values:

  • true: queries commands that meet the following requirements: The commands are run by calling the RunCommand or InvokeCommand operation with RepeatMode set to Period, NextRebootOnly, or EveryReboot. The executions of the commands are not canceled and not complete or are not stopped and not complete.

  • false: queries commands that meet the following requirements:

    • The commands are run by calling the RunCommand or InvokeCommand operation with RepeatMode set to Once.
    • The executions of the commands are canceled, stopped, or complete.

Default value: false.

true
InvokeStatusstringNo

The overall execution state of the command. The value of this parameter depends on the execution states on all involved instances. Valid values:

  • Running:

    • Scheduled execution: Before you manually stop the execution of the command, the overall execution state is always Running.
    • One-time execution: If the execution is in progress on one or more instances, the overall execution state is Running.
  • Finished:

    • Scheduled execution: The overall execution state can never be Finished.
    • One-time execution: The execution is complete on all instances, or the execution is manually stopped on some instances and is complete on other instances.
  • Failed:

    • Scheduled execution: The overall execution state can never be Failed.
    • One-time execution: The execution fails on all instances.
  • PartialFailed:

    • Scheduled execution: The overall execution state can never be PartialFailed.
    • One-time execution: The execution fails on some instances.
  • Stopped: The execution is stopped.

Finished
InstanceIdstringNo

The ID of instance N. When you specify this parameter, the system queries all the execution records of all the commands that run on the instance.

i-bp1i7gg30r52z2em****
ContentEncodingstringNo

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

  • PlainText: returns the original command content and command outputs.
  • Base64: returns the Base64-encoded command content and command outputs.

Default value: Base64.

PlainText
IncludeOutputbooleanNo

Specifies whether to return the command outputs in the response.

  • true: The command outputs are returned. When this parameter is set to true, you must specify InvokeId, InstanceId, or both.
  • false: The command outputs are not returned.

Default value: false

false
PageNumberlongNo

The page number of the page to return.

Page numbers start from 1.

Default value: 1.

1
PageSizelongNo

The number of entries to return per page.

Maximum value: 50.

Default value: 10.

10
MaxResultsintegerNo

The maximum number of entries per page.

Valid values: 1 to 50.

Default value: 10.

10
NextTokenstringNo

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

AAAAAdDWBF2
RepeatModestringNo

The execution mode of the command. Valid values:

  • Once: immediately runs the command.
  • Period: The command is run on a schedule.
  • NextRebootOnly: The command is automatically run the next time the instance starts.
  • EveryReboot: The command is automatically run every time the instance starts.

This parameter is empty by default, which indicates that commands run in all modes are queried.

Once
Tagobject []No

The tags that are added to the command.

KeystringNo

The key of tag N of the command. You can specify up to 20 tag keys for the command. 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 contain http:// or https://. The tag key cannot start with acs: or aliyun.

TestKey
ValuestringNo

The value of tag N of the command. You can specify up to 20 tag values for the command. The tag value can be an empty string. It can be up to 128 characters in length and cannot contain http:// or https://.

TestValue

Response parameters

ParameterTypeDescriptionExample
object
PageSizelong

The number of entries returned on each page.

10
RequestIdstring

The request ID.

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

The page number of the returned page.

1
TotalCountlong

The total number of the commands.

1
NextTokenstring

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

AAAAAdDWBF2
Invocationsobject []

Details about the command executions.

CreationTimestring

The time when the command task was created.

2020-01-19T09:15:46Z
Frequencystring

The schedule on which to run the command. For information about the value specifications, see Cron expression.

0 */20 * * * *
InvocationStatusstring

The overall execution state of the command. The value of this parameter depends on the execution states on all the involved instances. Valid values:

  • Pending: The command is being verified or sent. When the execution state on at least one instance is Pending, the overall execution state is Pending.

  • Scheduled: The command scheduled to run is sent and pending execution. When the execution state on at least one instance is Scheduled, the overall execution state is Scheduled.

  • Running: The command is being run on the instances. When the execution state on at least one instance is Running, the overall execution state is Running.

  • Success: When the execution state on at least one instance is Success and the execution state on other instances is Stopped or Success, the overall execution state is Success.

    • Command that is set to run only once: The execution is complete, and the exit code is 0.
    • Command that is set to run on a schedule: The last execution is complete, the exit code is 0, and the specified cycle ends.
  • Failed: When the execution state on all instances is Stopped or Failed, the overall execution state is Failed. When the execution state on an instance is one of the following values, Failed is returned as the overall execution state:

    • Invalid: The command is invalid.
    • Aborted: The command failed to be sent.
    • Failed: The command execution is complete, but the exit code is not 0.
    • Timeout: The execution timed out.
    • Error: An error occurred while the command was being run on the instance.
  • Stopping: The command task is being stopped. When the execution state on at least one instance is Stopping, the overall execution state is Stopping.

  • Stopped: The command task is stopped. When the execution state on all instances is Stopped, the overall execution state is Stopped. When the execution state on an instance is one of the following values, Stopped is returned as the overall execution state:

    • Cancelled: The command task is canceled.
    • Terminated: The command task is terminated.
  • PartialFailed: The execution is complete on some instances and fails on other instances. When the execution state is Success on some instances and is Failed or Stopped on other instances, the overall execution state is PartialFailed.

Note The InvokeStatus response parameter functions similarly to this parameter. We recommend that you ignore InvokeStatus and check the value of InvocationStatus.
Running
RepeatModestring

Indicates the execution mode of the command. Valid values:

  • Once: immediately runs the command.
  • Period: The command is run on a schedule.
  • NextRebootOnly: The command is automatically run the next time the instance starts.
  • EveryReboot: automatically runs the command every time the instance starts.
Once
CommandIdstring

The command ID.

c-hz0jdfwcsr****
CommandTypestring

The command type.

RunShellScript
InvokeStatusstring

The overall execution state of the command.

Note We recommend that you ignore this parameter and check the value of the InvocationStatus response parameter for the overall execution state.
Finished
Parametersstring

The custom parameters in the command.

{}
Timedboolean

Indicates whether the command is to be automatically run.

false
CommandContentstring

The Base64-encoded command content.

cnBtIC1xYSB8IGdyZXAgdnNm****
CommandNamestring

The command name.

CommandTestName
CommandDescriptionstring

The command description.

testDescription
InvokeIdstring

The command task ID.

t-hz0jdfwd9f****
Usernamestring

The username that was used to run the command on the instance.

root
WorkingDirstring

The execution path of the command.

/home/
Timeoutlong

The maximum timeout period for the command execution on the instance. Unit: seconds.

When a command cannot be run, the command execution times out. When a command execution times out, the Cloud Assistant client forcefully terminates the command process by canceling the PID of the command.

60
ContainerIdstring

The container ID.

ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****
ContainerNamestring

The container name.

test-container
InvokeInstancesobject []

Details about the instances on which the command is run.

CreationTimestring

The start time of the execution.

2019-12-20T06:15:54Z
UpdateTimestring

The time when the execution state was updated.

2020-01-19T09:15:47Z
FinishTimestring

The end time of the execution.

2019-12-20T06:15:56Z
InvocationStatusstring

The execution state 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 send a command to an instance, make sure that the instance is in the Running state and that the command is sent within 1 minute.

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

  • Success:

    • Command that is set to run only once: The execution is complete, and the exit code is 0.
    • Command that is set to run on a schedule: The previous execution is complete, the exit code is 0, and the specified cycle ends.
  • Failed:

    • Command that is set to run only once: The execution is complete, but the exit code is not 0.
    • Command that is set to run on a schedule: The previous execution is complete, the exit code is not 0, and the specified cycle is about to end.
  • Error: The execution cannot proceed due to an exception.

  • Timeout: The execution times out.

  • Cancelled: The execution is canceled, and the command is not started.

  • Stopping: The command task is being stopped.

  • Terminated: The command task is terminated while it is being run.

  • Scheduled:

    • Command that is set to run only once: The overall execution state can never be Scheduled.
    • Command that is set to run on a schedule: The command is pending execution.
Success
Repeatsinteger

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

  • If the execution is a one-time execution, the value is 0 or 1.
  • If the execution is a scheduled execution, the value is the number of times that the command is run.
0
InstanceIdstring

The instance ID

i-bp1i7gg30r52z2em****
Outputstring

The command output.

OutPutTestmsg
Droppedinteger

The size of the text that is truncated and discarded when the Output value exceeds 24 KB in size.

0
StopTimestring

The time when the command stopped being run on the instance. If you call the StopInvocation operation to manually stop the execution, the value is the time when you called the operation.

2020-01-19T09:15:47Z
ExitCodelong

The exit code of the execution. Valid values:

  • For Linux instances, the exit code is the exit code of the shell process.
  • For Windows instances, the exit code is the exit code of the batch or PowerShell process.
0
StartTimestring

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

2019-12-20T06:15:55Z
ErrorInfostring

Details about the reason why the command failed to be sent or run. Valid values:

  • If this parameter is empty, the execution is normal.
  • the specified instance does not exists
  • the instance has released when create task
  • the instance is not running when create task
  • the command is not applicable
  • the specified account does not exists
  • the specified directory does not exists
  • the cron job 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 now
  • the aliyun service in the instance is upgrading now
  • the command delivery has been timeout
  • the command execution has been timeout
  • the command execution got an exception
  • the command execution has been interrupted
  • the command execution exit code is not zero
the specified instance does not exists
Timedboolean

Indicates whether the command is to be automatically run.

false
ErrorCodestring

The code that indicates why the command failed to be sent or run. Valid values:

  • If this parameter is empty, the command is run normally.
  • InstanceNotExists: The instance does not exist or was released.
  • InstanceReleased: The instance was released while the command was being run.
  • InstanceNotRunning: The instance was not in the Running state while the command started to be run.
  • 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 cron expression used to specify a schedule is invalid.
  • ClientNotRunning: The Cloud Assistant client is not running.
  • ClientNotResponse: The Cloud Assistant client does not respond.
  • ClientIsUpgrading: The Cloud Assistant client is being upgraded.
  • ClientNeedUpgrade: The Cloud Assistant client needs to be upgraded.
  • DeliveryTimeout: The request to send the command timed out.
  • ExecutionTimeout: The execution timed out.
  • ExecutionException: An exception occurs while the command is being run.
  • ExecutionInterrupted: The execution was interrupted.
  • ExitCodeNonzero: The execution is complete, but the exit code is not 0.
InstanceNotExists
InstanceInvokeStatusstring

The execution state on a single instance.

Note We recommend that you ignore this parameter and check the value of the InvocationStatus response parameter for the overall execution state.
Finished
Tagsobject []

The tags of the command task.

TagKeystring

The tag key of the command task.

owner
TagValuestring

The tag value of the command task.

zhangsan

Examples

Sample success responses

JSONformat

{
  "PageSize": 10,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "PageNumber": 1,
  "TotalCount": 1,
  "NextToken": "AAAAAdDWBF2",
  "Invocations": {
    "Invocation": [
      {
        "CreationTime": "2020-01-19T09:15:46Z",
        "Frequency": "0 */20 * * * *",
        "InvocationStatus": "Running",
        "RepeatMode": "Once",
        "CommandId": "c-hz0jdfwcsr****",
        "CommandType": "RunShellScript",
        "InvokeStatus": "Finished",
        "Parameters": "{}",
        "Timed": false,
        "CommandContent": "cnBtIC1xYSB8IGdyZXAgdnNm****",
        "CommandName": "CommandTestName",
        "CommandDescription": "testDescription",
        "InvokeId": "t-hz0jdfwd9f****",
        "Username": "root",
        "WorkingDir": "/home/",
        "Timeout": 60,
        "ContainerId": "ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****",
        "ContainerName": "test-container",
        "InvokeInstances": {
          "InvokeInstance": [
            {
              "CreationTime": "2019-12-20T06:15:54Z",
              "UpdateTime": "2020-01-19T09:15:47Z",
              "FinishTime": "2019-12-20T06:15:56Z",
              "InvocationStatus": "Success",
              "Repeats": 0,
              "InstanceId": "i-bp1i7gg30r52z2em****",
              "Output": "OutPutTestmsg",
              "Dropped": 0,
              "StopTime": "2020-01-19T09:15:47Z",
              "ExitCode": 0,
              "StartTime": "2019-12-20T06:15:55Z",
              "ErrorInfo": "the specified instance does not exists",
              "Timed": false,
              "ErrorCode": "InstanceNotExists",
              "InstanceInvokeStatus": "Finished"
            }
          ]
        },
        "Tags": {
          "Tag": [
            {
              "TagKey": "owner",
              "TagValue": "zhangsan"
            }
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400RegionId.ApiNotSupportedThe 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.
400NumberExceed.TagsThe Tags parameter number is exceed.The number of tags exceeds the maximum limit.
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.The specified tag key already exists. Tag keys must be unique.
400InvalidTagKey.MalformedThe specified Tag.n.Key is not valid.The specified Tag.N.Key parameter is invalid.
400InvalidTagValue.MalformedThe specified Tag.n.Value is not valid.The specified tag value is invalid.
400MissingParameter.TagKeyYou must specify Tag.N.Key.The tag key is not specified.
400InvalidParam.PageNumberThe specified parameter is invalid.The specified PageNumber parameter is invalid.
400InvalidParam.PageSizeThe specified parameter is invalid.The specified PageSize parameter is invalid.
400InvalidParameter.NextTokenThe specified parameter NextToken is not valid.The specified parameter NextToken is illegal.
400InvalidParameter.MaxResultsThe specified parameter MaxResults is not valid.The specified parameter MaxResults is illegal.
403Operation.ForbiddenThe operation is not permitted.The operation is not supported.
404InvalidRegionId.NotFoundThe RegionId provided does not exist in our records.The RegionId provided does not exist
500InternalError.DispatchAn error occurred when you dispatched the request.An error occurred while the request is being sent. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-21The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: MaxResults
    Added Input Parameters: NextToken
Output ParametersThe response structure of the API has changed.
2023-05-12The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
    delete Error Codes: 404
    delete Error Codes: 500
2022-07-07The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.
2022-06-22The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.
2021-05-12The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 403 change
    Error Codes 404 change
    delete Error Codes: 400
    delete Error Codes: 500