After you upload objects to a bucket, Object Storage Service (OSS) automatically generates
URLs that include the public endpoint of the bucket for the uploaded objects. You
can use these URLs to access the objects. If you want to access the objects by using
a custom domain name, you must map the custom domain name to the bucket in which the
objects are stored.
Procedure
- Map a custom domain name to a bucket.
- Log on to the OSS console.
- In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket that you want to manage.
- In the left-side navigation pane, choose .
- Click Map Custom Domain Name.
- In the Map Custom Domain Name panel, enter the domain name that you want to map in the Custom Domain Name field.
Domain names that contain wildcard characters are not supported. Example:
*.example.com
.
If a message appears, which indicates that a domain name conflict occurs, the domain
name is mapped to another bucket. To resolve this issue, you can map another domain
name to the bucket or verify the ownership of the domain name and forcibly map the
domain name to the bucket. If you verify the ownership of the domain name and forcibly
map the domain name to the bucket, the mapping between the domain name and another
bucket is removed. For more information, see Verify the ownership of a domain name.
- Add a CNAME record.
- If the domain name is managed by your Alibaba Cloud account, perform the following
steps to automatically add a CNAME record.
- In the Map Custom Domain Name panel, turn on Add CNAME Record Automatically.
Notice If the domain name has a CNAME record, the CNAME record is updated to the new CNAME
record.
- Click Submit.
- If the domain name is not managed by your Alibaba Cloud account, manually add a CNAME
record.
If the domain name is not hosted by Alibaba Cloud, you must add a CNAME record to
the Domain Name System (DNS) of your DNS provider.
The following example shows how to use Alibaba Cloud DNS to manually add a CNAME record
for a domain name that is not hosted by Alibaba Cloud:
- Log on to the Alibaba Cloud DNS console.
- On the Manage DNS page, click Configure in the Actions column of the domain name to which you want to add a CNAME record.
- On the DNS Settings page, click Add Record. In the Add Record panel, configure the parameters. The following table describes
the parameters.
Parameter |
Description |
Type |
Select the type of the record that you want to add. In this example, CNAME is selected.
|
Host |
Enter the host record based on the prefix of the domain name.
- To add a top-level domain such as
aliyun.com , enter @.
- To add a second-level domain, enter the prefix of the second-level domain. If the
domain name is
help.aliyun.com , enter help.
- To map all second-level domains to the domain name of the bucket, enter *.
|
ISP Line |
Select the ISP line that is used to resolve the domain name. To allow the system to
select the optimal line, we recommend that you select Default for this parameter.
|
Value |
Enter the domain name of the bucket. The domain name of a bucket is in the BucketName.Endpoint format. The public endpoint of the China (Hangzhou) region is oss-cn-hangzhou.aliyuncs.com . If you create a bucket named examplebucket in the China (Hangzhou) region, the domain
name of the bucket is examplebucket.oss-cn-hangzhou.aliyuncs.com .
|
TTL |
Select the interval at which the record is updated. In this example, the default value
is used.
|
- Click Confirm.
A new CNAME record immediately takes effect. The time required for a modified CNAME
record to take effect is 72 hours.
Check whether the CNAME record takes effect
You can run the ping command or the lookup command to check whether a specified CNAME is in effect. If the request is redirected
to *.oss-cn-*.aliyuncs.com
, the CNAME is in effect.
Verify the ownership of a domain name
If a message appears, which indicates that a domain name conflict occurs, you can
verify the ownership of the domain name and forcibly map the domain name to the bucket.
- Click Obtain TXT.
OSS randomly generates a token for the domain name, which includes the following fields:
Domain,
Host, and
Value. Store the token information in a secure location.

- Add a TXT record to your DNS records. Enter the recorded values of the Host and Value fields and retain the default settings of other parameters.
- In the Map Custom Domain Name panel, read and select I have added the TXT record. Continue submission.
If your configurations are correct, OSS maps the custom domain name to the bucket.
Remove a domain name mapping
If you no longer need to use a custom domain name, you can remove the mapping of the
custom domain name from a bucket.
- On the management page of the bucket from which you want to remove the custom domain
name mapping, choose .
- On the Domain Names tab, click Manage Mapping Configurations in the Actions column of the domain name for which you want to remove the mapping.
- In the Manage Mapping Configurations panel, click Unbind. Then, click OK.