You can use Object Storage Service (OSS) to store data such as images, videos, and audio data from your applications, and you can concurrently download large amounts of data that you store in OSS. You can also use OSS together with Intelligent Media Management (IMM) and Image Processing (IMG) to process your data in the cloud. This topic describes how to activate OSS, create a bucket, upload an object, download an object, and share an object. In this topic, an image object is used as an example.
Prerequisites
An Alibaba Cloud account is created. For more information, see Sign up to Alibaba Cloud.
Activate OSS
Go to the OSS activation page.
On the OSS activation page, follow the on-screen instructions to activate OSS.
ImportantAfter OSS is activated, the default billing method is pay-as-you-go. If you want to reduce OSS fees, we recommend that you use OSS resource plans.
Create a bucket
A bucket is a container for objects stored in OSS. You must create a bucket before you upload an object to OSS.
Log on to the OSS console.
In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket.
In the Create Bucket panel, configure the required parameters described in the following table. You can keep the default settings for other parameters or configure the parameters after the bucket is created. Click OK.
Parameter
Description
Example
Bucket Name
The name of the bucket. The name of a bucket cannot be changed after the bucket is created.
For more information about bucket naming conventions, see Bucket naming conventions.
examplebucket
Region
The region in which you want to create the bucket. The region of a bucket cannot be changed after the bucket is created.
ImportantIf you want to create a bucket in a region in the Chinese mainland, you must complete real-name registration by submitting your information on the Real-name Registration page.
China (Hangzhou)
Redundancy Type
The redundancy type of the bucket. Valid values:
LRS
Locally redundant storage (LRS) allows you to store multiple copies of your data on multiple devices of different facilities in the same zone. LRS provides data durability and availability even if hardware failures occur.
ZRS (Recommended)
ZRS stores multiple copies of your data across multiple zones in the same region. Your data is still accessible even if a zone becomes unavailable.
ImportantZone-redundant storage (ZRS) is supported in the following regions: China (Shenzhen), China (Beijing), China (Zhangjiakou), China (Ulanqab), China (Hangzhou), China (Shanghai), China (Hong Kong), Germany (Frankfurt), Japan (Tokyo), Singapore, and Indonesia (Jakarta). ZRS increases your storage costs and cannot be disabled after it is enabled. We recommend that you exercise caution when you select ZRS.
For more information about ZRS, see Create a ZRS bucket.
ZRS (Recommended)
Click OK and click Confirm.
After the bucket is created, the Created message is displayed.
Upload an object
You can upload an object up to 5 GB in size in the OSS console.
After you create the bucket, click Go to Bucket. Alternatively, you can click Buckets in the left-side navigation pane and click the name of the created bucket.
On the Objects page, click Upload Object.
On the Upload Object page, configure the parameters described in the following table.
Parameter
Description
Example
Upload To
Specify the directory to which you want to upload the object. Valid values:
Current Directory: The object is uploaded to the current directory.
Specified Directory: The object is uploaded to a specific directory. If the specified directory does not exist, OSS automatically creates the directory and uploads the object to the directory.
Current Directory
Object ACL
Configure the access control list (ACL) of the object.
For more information, see Object ACLs.
Private
Files to Upload
Select the local file or directory that you want to upload.
You can click Select Files to select a local file or click Select Folders to select a directory. You can also drag the local file or directory to the Files to Upload section.
ImportantIf you drag a directory to the Files to Upload section to upload it, all files and subdirectories in this directory are uploaded to the bucket.
Do not refresh or close the Upload Object page when objects are being uploaded. Otherwise, the upload tasks are interrupted, and the list of upload tasks is cleared.
example.jpg
Click Upload Object.
You can view the upload progress of the file in the Upload Tasks panel. After the object is uploaded, you can go to the directory that contains the object to view the name, size, and storage class of the object.
Download objects
After you upload objects to a bucket, you can download the objects to the default download path of your browser or a specific local path. You can download one or more objects at a time.
In the left-side navigation tree, choose Object Management > Objects.
Download objects.
Download one object at a time
Find the object that you want to download in the object list and choose
.Download multiple objects at a time
Select the objects that you want to download and click Download below the object list. You can download up to 100 objects at a time in the OSS console.
For more information about how to download objects from a versioning-enabled bucket, see Configure versioning.
Share an object
After you upload an object to a bucket, you can share the URL of the object with third parties for downloads or previews.
In the left-side navigation tree, choose Object Management > Objects.
On the Objects page, click the name of the object or click View Details in the Actions column.
In the View Details panel, click Copy Object URL.
WarningCheck whether the object that you want to share contains sensitive data to prevent leakage of sensitive data.
If the ACL of the object that you want to share is private, you must configure Validity Period of the URL. The default validity period of a URL is 3,600 seconds (1 hour). The maximum validity period is 32,400 seconds (9 hours). To obtain a URL with a longer validity period, we recommend that you use ossutil, ossbrowser, or OSS SDKs.
Preview an object by using the object URL
To ensure that an object is previewed but not downloaded when third parties use the object URL that you share to access the object, you must map a custom domain name to your bucket and add a CNAME record for the domain name. For more information, see Map a custom domain name to the default domain name of a bucket.
Download an object by using the object URL
If you want an object to be downloaded when third parties use the shared object URL to access the object, set the Content-Disposition field to
attachment
. For more information, see Manage object metadata.