Modifies the execution information of a Cloud Assistant scheduled command task, including modifying the content and execution frequency of the command and adding Elastic Compute Service (ECS) instances or Alibaba Cloud managed instances to the command task.
Operation description
-
You can modify the execution information of a task that runs a command in one of the following modes. To query the execution mode of a command, you can call the DescribeInvocations operation and check the
RepeatMode
value in the response.- Period: The task runs the command on a schedule.
- NextRebootOnly: The task runs the command the next time the associated instances start.
- EveryReboot: The task runs the command every time the associated instances start.
-
You can modify the execution information of a command task in one of the following execution states. To query the execution status of a command, you can call the DescribeInvocations operation and check the
InvocationStatus
value.- 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.
- Running: The command is being run on instances. When the execution state on at least one instance is Running, the overall execution state is Running.
- Scheduled: The command that is set to run on a schedule is sent and waiting to be run. When the execution state on at least one instance is Scheduled, the overall execution state is Scheduled.
- Stopping: The command task is being stopped. When the execution state on at least one instance is Stopping, the overall execution state is Stopping.
-
Before you modify the execution information of a scheduled task, such as the command content, custom parameters, and execution frequency, make sure that the version of Cloud Assistant Agent on the ECS instances or managed instances associated with the task is later than the following versions:
- Linux: 2.2.3.541
- Windows: 2.1.3.541
- If the
InvalidOperation.CloudAssistantVersionUnsupported
error code is returned in the response, update Cloud Assistant Agent to the latest version.
-
You cannot modify
CommandContent
for a common Cloud Assistant command. -
If you modify the
CommandContent
value of a command and setKeepCommand
totrue
when you call the InvokeCommand or RunCommand operation to run the command, a new command is added and retained. The new command consumes the quota for Cloud Assistant commands. You can retain up to 500 to 50,000 Cloud Assistant commands in each region. You can apply for a quota increase. For information about how to query and increase quotas, see Manage quotas.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ecs:ModifyInvocationAttribute | update | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID. | cn-hangzhou |
InstanceId | array | No | The IDs of the ECS instances or managed instances that you want to add to the scheduled command task. | |
string | No | The ID of the ECS instance or managed instance that you want to add to the scheduled command task. The total number of instances in the scheduled command task after you add ECS instances or managed instances cannot exceed 100. | i-bp1i7gg30r52z2em**** | |
InvokeId | string | Yes | The execution ID of the command. | t-hz0jdfwd9f**** |
CommandContent | string | No | The content of the command after modification. The command content can be plaintext or Base64-encoded. Take note of the following items:
| ZWNobyAxMjM= |
EnableParameter | boolean | No | Specifies whether to include custom parameters in the command.
| false |
Parameters | object | No | The key-value pairs of the custom parameters that are passed in if custom parameters are included in the command. You can specify 0 to 10 custom parameters. Take note of the following items:
This parameter is empty by default, which indicates not to modify the key-value pairs of the custom parameters. | {"name":"Jack", "accessKey":"LTAIdyvdIqaRY****"} |
Frequency | string | No | The frequency at which to run the command. This parameter takes effect only when
| 0 */20 * * * * |
ContentEncoding | string | No | The encoding mode of the command content that is specified by
Default value: PlainText. If the value is invalid, the PlainText mode is used. | PlainText |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"CommandId": "c-hz01272yr52****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.Frequency | The specified parameter Frequency is not valid. | The specified parameter Frequency is illegal. |
400 | InvalidParameters.KeyDuplicate | The key in the parameter Parameters cannot be duplicated. | Keys in parameter Parameters cannot be duplicated. |
400 | InvalidParameters.KeyNotMatch | The key in the parameter Parameters do not match those defined when creating the command. | The key in the parameter Parameters does not match the one defined when the command was created. |
400 | InvalidParameters.KeyMalformed | The key in the parameter Parameters is not valid. | - |
400 | InvalidParameters.KeyEmpty | The key in the parameter Parameters cannot be empty. | The key in the parameter Parameters cannot be empty. |
400 | InvalidCommandContent.DecodeError | The specified parameter CommandContent can not be Base64 decoded. | Parameter CommandContent cannot be Base64 decoded. |
403 | InvalidInstanceId.OSTypeUnsupported | The OS type of the instance corresponding to the parameter InstanceId does not support the specified command type. | - |
403 | InvalidOperation.RepeatModeUnsupported | The operation is not supported for current repeat mode of invocation. | - |
403 | InvalidOperation.InvokeAlreadyFinished | The operation is not supported for finished invocation. | The operation is not supported for completed tasks. |
403 | InvalidOperation.CloudAssistantVersionUnsupported | The operation is not supported for current CloudAssistant version of instance. | - |
403 | InvalidOperation.ModifyPublicCommandUnsupported | Modification of the content of Public Command is not supported. | Modifying the contents of public commands is not supported. |
403 | InvalidCommandContent.LengthLimitExceeded | %s | - |
403 | InvalidParameters.CountLimitExceeded | The count of the parameter Parameters exceeds the limit of 10. | The number of parameter Parameters exceeds the limit of 10. |
403 | InvalidParameters.KeyLengthLimitExceeded | The length of the key in the parameter Parameters exceeds the limit of 64 characters. | - |
403 | InvalidInstanceId.CountLimitExceeded | %s | - |
403 | CommandLimitExceeded | %s | - |
403 | InvalidParameters.ValueTypeUnsupported | The type of the value in the parameter Parameters is not supported. | The type of the value Parameters the parameter is not supported. |
404 | InvalidInvokeId.NotFound | The specified parameter InvokeId does not exist. | The specified command execution ID does not exist. |
404 | InvalidInstanceId.NotFound | The specified parameter InstanceId does not exist. | The specified instance ID does not exist. |
404 | InvalidRegionId.NotFound | The specified parameter RegionId does not exist. | - |
500 | InternalError | An error occurred when you dispatched the request. | An error occurred while sending the request, please try again later. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-04-03 | The Error code has changed | View Change Details |