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
- Supports modifying tasks with the following execution modes (refer to the
RepeatModevalue returned by DescribeInvocations):Period: Execute periodically.
NextRebootOnly: Automatically execute the command the next time the instance starts.
EveryReboot: Automatically execute the command every time the instance starts.
- Supports modifying tasks in the following statuses (refer to the
InvocationStatusvalue returned by DescribeInvocations):Pending: The system is validating or sending the command. If at least one instance has a command execution status of Pending, the overall execution status is Pending.
Running: The command is running on an instance. If at least one instance has a command execution status of Running, the overall execution status is Running.
Scheduled: The scheduled command has been sent and is waiting to run. If at least one instance has a command execution status of Scheduled, the overall execution status is Scheduled.
Stopping: The task is being stopped. If at least one instance has a command execution status of Stopping, the overall execution status is Stopping.
- Before modifying the execution information of a scheduled task (including command content, Custom Parameters, and execution frequency), the Cloud Assistant Agent version on the involved ECS instances or managed instances must be higher than the following versions:
Linux: 2.2.3.541
Windows: 2.1.3.541
If the response returns the error code
InvalidOperation.CloudAssistantVersionUnsupported, update the Cloud Assistant Agent to the latest version.
When you execute a Cloud Assistant public command, you cannot modify the
CommandContent.If you modify the
CommandContentand create a task by invoking InvokeCommand or RunCommand withKeepCommandset totrue, a new command will be created and retained permanently, consuming your Cloud Assistant command quota. In each Region, you can retain between 500 and 50,000 Cloud Assistant commands. You can request a quota increase. For more information about how to query and increase your quota, see Quota Management.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:ModifyInvocationAttribute |
update |
*Invocation
Instance
|
None | 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**** |
|
| RegionId |
string |
Yes |
The region ID. |
cn-hangzhou |
| 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":"LTAI*************"} |
| 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 |
| ClientToken |
string |
No |
Ensures the idempotence of the request. Generate a unique parameter value from your client to guarantee uniqueness across different requests. ClientToken supports only ASCII characters and cannot exceed 64 characters. For more information, see How to ensure idempotence. |
123e4567-e89b-12d3-a456-426655440000 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
| CommandId |
string |
The command ID.
|
c-hz01272yr52**** |
Examples
Success response
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. |
| 400 | InvalidClientToken.Malformed | The specified parameter clientToken is not valid. | |
| 500 | InternalError | An error occurred when you dispatched the request. | An error occurred while sending the request, please try again later. |
| 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 | The length of the parameter CommandContent exceeds the limit of %s KB characters. | |
| 403 | Operation.Forbidden | The operation is not permitted. | The operation is not supported. |
| 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 | The count of the parameter InstanceId exceeds the limit of %s. | |
| 403 | CommandLimitExceeded | The count of command in current region exceeds the limit of %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. |
| 403 | IdempotentParameterMismatch | The specified parameter has changed while using an already used clientToken. | |
| 403 | IdempotentProcessing | The previous idempotent request(s) is still processing. | A previous idempotent request is being processed. Try again later. |
| 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. | |
| 404 | InvalidCommandId.NotFound | The specified CommandId does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.