After you create a Cloud Assistant script, you can run it on one or more instances. The execution status and results of the script on multiple instances do not affect each other.


Before you run a Cloud Assistant script on ECS instances, ensure 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 about how to install a Cloud Assistant client, see Install the Cloud Assistant client.

Background information

  • You can specify up to 50 instances in one script execution.
  • You can run Cloud Assistant scripts up to 5,000 times within a region each 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 scripts within a region each 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 script 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 script content.
      If the script is incorrect, modify the script before you run it.
    2. In the Parameters field, enter values for the custom parameters specified in the script.
      There are no data type restrictions for custom parameters. If the current API call does not require values for the custom parameters, you can enter empty strings.
      Note If you did not turn on Use Parameters when you created the script, 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 script information before you execute the script.
  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, it indicates that Cloud Assistant clients have been 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 script 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 Timed=true and specifying the Frequency parameter. For example, 0 */20 * * * * indicates that the execution cycle is 20 minutes. For more information about cron expressions, see Cron expression.

What to do next

View the execution result of a script