All Products
Search
Document Center

Elastic Compute Service:Batch upload a single file to multiple ECS instances

Last Updated:Jan 23, 2025

Using CloudOps Orchestration Service (OOS), you can efficiently upload a single file to multiple ECS instances. This service accommodates local files, OSS-stored files, and HTTPS remote files. This topic guides you through the process of using OOS to upload a file to multiple ECS instances simultaneously.

Note

OOS, offered by Alibaba Cloud, is an automated operations and maintenance service designed to manage and execute cloud-based tasks efficiently. For more information, see the referenced document.

Prerequisites

Ensure that the instance status is Running.

Step 1: Determine the file type to be uploaded

OOS supports uploading three types of files. Choose a file type that aligns with your business needs to streamline the subsequent steps.

File type

Description

Size limit

Local File

A file that is stored on an on-premises computer or server.

The file size cannot exceed 500 MB.

OSS File

A file that is stored in an OSS bucket.

None

HTTPS File

A remote file that can be accessed over HTTPS. It is usually hosted on a web server and transmitted over HTTPS. The file link starts with https://.

None

Step 2: Prepare the upload environment

Based on the file type selected in the previous step, complete the necessary preparations to create the conditions for uploading your chosen file type.

  • Local File

    Locate the storage path of the file on your local computer or server to facilitate quick access during the upload process.

  • OSS File

    1. To upload a file, store it in an OSS bucket. For more information, see the referenced document.

    2. Create an ECS instance RAM role and assign it the necessary access privileges to resources, such as AliyunOSSReadOnlyAccess. Next, attach the RAM role to your ECS instance. For more information, see the referenced document.

      How to Batch Grant Instance RAM Roles to Multiple ECS Instances

      1. Log on to the CloudOps Orchestration Service console.

      2. Select the region where the ECS instances are located from the top navigation bar.

      3. From the left-side navigation pane, choose Automated Tasks > Common O&M Tasks > Batch Operate Instances, and then click Create.

      4. On the Create A Batch Operate Instances Task page, configure the following parameters.

        • Task Type: Choose Instance Operation.

        • Operation To Be Performed: Select Add Role.

        • Role Name: Choose the created ECS instance RAM role.

        • Select Instances: Follow the instructions to batch select ECS instances.

      5. Click Create, and then click Confirm in the Parameter Confirmation dialog box that appears.

        Once the Execution Status on the task execution details page shows Success, the instance RAM role has been granted to the ECS instances.

  • HTTPS File

    Retrieve the URL for the HTTPS file and ensure that the ECS instances where you plan to upload the file have internet access. For more information, see the referenced document or the referenced document.

Step 3: Batch upload files

  1. Log on to the CloudOps Orchestration Service console.

  2. Select the region where the ECS instances are located from the top navigation bar.

  3. From the left-side navigation pane, choose Automated Tasks > Common O&M Tasks > Batch Operate Instances, and then click Create.

  4. On the Create A Batch Operate Instances Task page, fill in the parameters as directed.

    Note

    For parameters not mentioned here, retain the default settings.

    Parameter

    Example

    Task Type

    Select Batch Download File.

    File Type

    Select the corresponding option based on the file type. The example in this topic is Local File.

    Select File

    1. Select the local file that you want to upload or drag the file to the gray area of Select File. The example in this topic is image.png.

    2. Select I Agree To Store The File In The Temporary OSS Bucket Provided By Alibaba Cloud.

      Note

      Alibaba Cloud temporarily stores the file that you want to upload in an OSS bucket. After you upload the file to the selected ECS instances, Alibaba Cloud automatically deletes the file from the OSS bucket. The validity period of the file URL is 900 seconds.

    File Save Path

    The example in this topic is /root.

    ```html Select Instances

    Select a method to filter ECS instances and select one or more ECS instances to receive the file based on your business requirements. The example in this topic is Manually Select Instances.

    Note

    If you need to batch operate many instances, select Specify Instance Tag or Specify Instance Resource Group. You can use tags or resource groups to more conveniently select destination instances. For more information, see the referenced document and the referenced document.

    image

  5. Click Create, and then click Confirm in the Parameter Confirmation dialog box that appears.

    When the Execution Status indicates Success on the task execution details page, the file has been successfully uploaded to the ECS instances.

    image

  6. (Optional) Verify the file's integrity and functionality.

    1. Connect to the ECS instances. For additional details, see the referenced document.

    2. Inspect the uploaded file on the ECS instance. Consider the following checks:

      • Compare the file size before and after uploading to detect any changes.

      • Run the application or script to confirm it operates as intended.

      • Open media files or documents to ensure they are intact and readable.

References

  • When uploading script or application files, you can set up scheduled tasks to run them according to a defined schedule using Alibaba Cloud OOS for cron jobs. For more information, see the referenced document and the referenced document.

  • To safeguard your data and facilitate restoration, it's advisable to back up the data on your ECS instances once files have been uploaded. Creating snapshots of your disks enhances operational fault tolerance and secures your data. For more information, see the referenced document.