All Products
Search
Document Center

Elastic Compute Service:Transfer files to an ECS instance by using OSS

Last Updated:Feb 07, 2025

If you want to transfer large files to an Elastic Compute Service (ECS) instance or transfer files to an ECS instance that is not connected to the Internet, you can upload the files to an Object Storage Service (OSS) bucket and then download the files from the OSS bucket to the ECS instance.

Overview

image

To transfer a file to an ECS instance by using OSS, perform the following steps:

  1. Upload the file to an OSS bucket that resides in the same region as the ECS instance.

  2. Download the file from the OSS bucket to the ECS instance over the internal network.

Billing

  • You are charged storage fees for files stored in an OSS bucket.

  • You are not charged data transfer fees when you upload files to an OSS bucket.

  • You are not charged data transfer fees when you download files from an OSS bucket to an ECS instance over the internal network within the same region.

  • You are charged request fees when you upload files to or download files from an OSS bucket.

For information about the billable items of OSS, see Billable items.

Step 1: Upload a file to an OSS bucket

Upload the file that you want to transfer to an ECS instance to an OSS bucket. Make sure that the OSS bucket and the ECS instance reside in the same region. You can install the ossbrowser tool on your on-premises computer and use the tool to upload the file to the OSS bucket.

Important

When you use the ossbrowser tool to transfer 10 GB or larger files over the Internet, the transfer may fail due to network issues. If you want to upload 10 GB or larger files over the Internet, perform the operations described in Multipart upload.

Install the ossbrowser tool on your on-premises computer and use the tool to upload a file to an OSS bucket. Perform the following steps:

  1. Install and log on to the ossbrowser tool.

    For more information, see Install and log on to ossbrowser.

  2. Create an OSS bucket.

    1. In the upper-left corner of the ossbrowser tool, click Create Bucket. In the Create Bucket dialog box, configure the following parameters. Use the default settings for other parameters.

      • Name: Follow the on-screen instructions to enter a name for the OSS bucket.

      • Region: Select the region in which the ECS instance resides.

    2. Click OK.

  3. Upload the file to the OSS bucket.

    1. Find the OSS bucket that you created in Step 2 and click the bucket name to access the bucket.

    2. In the upper-left corner of the page that appears, click Upload. Follow the on-screen instructions to upload the file. Wait until the file is uploaded.

  4. Obtain the download URL of the file.

    1. Find the file that you uploaded in Step 3 and click Address in the Actions column.

    2. In the Get Address dialog box, click Generate. After the download URL of the file is generated, click Copy to obtain the URL.

Step 2: Download the file from the OSS bucket

After you upload the file to the OSS bucket, you can log on to the ECS instance and download the file from the OSS bucket to the ECS instance over the internal network.

  1. Convert the download URL of the file to an internal download URL.

    The download URL that you obtained in Step 1 is a public download URL. Add -internal before .aliyuncs.com in the public download URL to convert the public download URL to an internal download URL. ECS instances that reside in the same region as the OSS bucket can access the file over the internal network by using the internal download URL. This prevents data transfer fees.

    Note

    For example, convert the public download URL https://****.oss-cn-hangzhou.aliyuncs.com/demo-1.0.jar?****** to the internal download URL https://****.oss-cn-hangzhou-internal.aliyuncs.com/demo-1.0.jar?******.

  2. Download the file to the ECS instance over the internal network.

    Windows instance

    1. Connect to the Windows instance. In this example, Workbench is used to connect to the ECS instance. For more information, see Use Workbench to connect to a Windows instance over RDP.

    2. Open a browser on the ECS instance and enter the internal download URL that you obtained in Step 1. After you access the URL, the file is downloaded to the ECS instance by using the browser.

      You can also install the ossbrowser or ossutil tool on the Windows instance to download the file. For more information, see Simple download.

    Linux instance

    1. Connect to the Linux instance. In this example, Workbench is used to connect to the ECS instance. For more information, see Use Workbench to connect to a Linux instance over SSH.

    2. Run the following command to download the file. In this example, the wget command is used to download the file. You can also use common tools to download the file.

      wget -O <filename> '<file_internal_url>'

      Before you run the command, replace <filename> with the name to which you want to rename the downloaded file and <file_internal_url> with the internal download URL that you obtained in Step 1. For example, to download a file whose internal download URL is https://****.oss-cn-hangzhou-internal.aliyuncs.com/demo-1.0.jar?****** to the ECS instance and rename the file to demo.jar, run the following command:

      wget -O demo.jar 'https://****.oss-cn-hangzhou-internal.aliyuncs.com/demo-1.0.jar?******'

(Optional) Step 3: Clear resources

After you download all files, you can delete files that you no longer require from the OSS bucket to prevent additional storage fees. For more information, see Delete objects.

References

For more information about OSS, see What is OSS?