🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

Method for uploading and downloading files to Alibaba Cloud OSS using the ossutil tool

Alibaba Cloud OSS cloud storage service can help individual and enterprise users store resources. Compared to using one's own server for storage, it offers higher stability, faster speed, greater efficiency, and is even cheaper. It is very suitable for websites that need to provide downloads or display a large number of files externally. Besides normal cloud storage usage, we can also utilize OSS for website backups or temporary resource forwarding. Today, while migrating a client's server, Naiba used this service and took the opportunity to document how to use the ossutil tool to upload files to OSS and then how to download files from OSS on the new server.Use Case:
  • Server A, configuration: 1 core, 1GB RAM, 5Mbps bandwidth
  • Server B, configuration: 2 cores, 8GB RAM, 6Mbps bandwidth
  • The compressed website data on Server A is 4GB in size, with a maximum download speed of 600KB/s. Moving data from A to B would be very slow.
Therefore, Naiba used OSS as an intermediate network drive for temporary data storage. (A and B are not in the same region, or perhaps firewall rules were not opened, and the client did not provide the Alibaba Cloud admin account, so internal network transfer was not possible.)Solution:Purchase anAlibaba Cloud OSS service(discount package: 6 RMB for 6 months), then use the ossutil tool on both servers A and B to upload and download the website backup data.

ossutil Tutorial

Create a RAM Account

Open theRAM Access Controlpage, User, Create User, then assign permissions to the account, obtain theaccessKeyIDaccessKeySecretRAM访问控制权限Save the obtained accessKeyID and accessKeySecret values securely.

Install and Configure ossutil

1. Download ossutil on the serverwget http://gosspublic.alicdn.com/ossutil/1.6.10/ossutil64 2. Modify file permissionschmod 755 ossutil643. Configure ossutil
./ossutil64 config
请输入配置文件名,文件名可以带路径(默认为:/home/user/.ossutilconfig,回车将使用默认路径。如果用户设置为其它路径,在使用命令时需要将--config-file选项设置为该路径): 
未输入配置文件路径,将使用默认配置文件:/home/user/.ossutilconfig。 
对于下述配置,回车将跳过相关配置项的设置,配置项的具体含义,请使用"help config"命令查看。 
请输入endpoint:
请输入accessKeyID:yourAccessKeyID 
请输入accessKeySecret:yourAccessKeySecret
请输入stsToken:
4. Copy the OSS endpoint addressOSS EndPoint地址5. Fill in the endpoint, accessKeyID, and accessKeySecret into the configuration information respectively.

Using ossutil to Upload and Download Files

The command to upload a single file is as follows:./ossutil64 cp 要上传的文件名 oss://路径The command to download a single file is as follows:./ossutil64 cp oss://路径/文件名 /服务器路径That's it, it's done. Large files can be quickly transferred between two hosts via OSS. Official documentation: https://help.aliyun.com/document_detail/50452.html?spm=a2c4g.11174283.6.1275.24747da2SQFT45

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step.

「Naibabiji WordPress Website Building Coaching Service」—From choosing a domain and buying hosting, to installing a Theme and publishing content, I「ll coach you through every step, helping you avoid detours and reach your goal directly.

👉 Learn about the Website Building Coaching Service
🔒

Comments are closed

The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.

×
二维码

Scan QR Code to Follow

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: