After you create Cloud Assistant commands, you can run them on one or more ECS instances. The execution status and results on multiple instances do not affect each other.

Prerequisites

Before you run a Cloud Assistant command on ECS instances, make sure that the instances meet the following requirements:
  • The instances are in the Running (Running) state.
  • The instances are installed with the Cloud Assistant client. For more information, see Install the Cloud Assistant client.

Background information

  • You can run a command on a maximum of 50 instances at a time by calling an API operation.
  • If you select more than 50 instances to run a command in the ECS console, the system automatically runs the command on instances in batches.
  • You can run Cloud Assistant commands up to 5,000 times within a region per day. The quota may increase with your ECS usage.
    Note You can also call the DescribeAccountAttributes operation, with the AttributeName.N parameter set to max-axt-invocation-daily, to query the maximum number of times you can run Cloud Assistant commands within in a region per day.

Procedure in the console

  1. Log on to the ECS console and navigate to the Cloud Assistant page.
  2. In the top navigation bar, select a region.
  3. Find the command that you want to run and click Create Task in the Actions column.
  4. In the Create Task pane that appears, configure the parameters.
    1. Optional:Click View to check the command content.
      If the command is incorrect, modify the command before you run it.
    2. In the Parameters field, enter values for the custom parameters that are specified in the command.
      The data type format of values for the custom parameters is not limited. If the current API call does not require values for the custom parameters, you can enter empty strings.
      Note If you do not select Use Parameters when you create a command, the Parameters field is not displayed in the Create Task pane.
    3. In the Select Instance section, select one or more instances.
      If you have multiple instances, you can enter an instance ID or name to search for the instance, and select a specific tag or client status from the drop-down lists to narrow down the searching results.
    Check the command information before you execute the command.
  5. Click Create Task.

Procedure by using CLI

  1. Optional:Check the status of the target instances. If the instances are not in the Running (Running) state, call the StartInstance operation to run the target instances.
    aliyun ecs StartInstance --InstanceId i-bp1g6zv0ce8og******p
  2. Optional:Call the DescribeCloudAssistantStatus operation to query whether Cloud Assistant clients are installed on the target instances.
    If CloudAssistantStatus=true is returned, Cloud Assistant clients are installed. Otherwise, call the InstallCloudAssistant operation to install Cloud Assistant clients on the target instances.
  3. Call the InvokeCommand operation to run the created Cloud Assistant command on the target instances and obtain the response parameter InvokeId.
    aliyun ecs InvokeCommand --RegionId TheRegionId --InstanceId.1 i-bp1g6zv0ce8og******p --InstanceId.2 i-bp1g6zv0ce8og******p --CommandId your-command-id --Timed false --output cols=InvokeId
    You can specify the execution cycles of recurring tasks by setting the Timed parameter to true and specifying the Frequency parameter. For example, 0 */20 * * * * indicates that the execution cycle is 20 minutes. For more information, see Cron expression.

What to do next

View the execution result of a script