To query the custom domain names mapped to a bucket and the status of the domain names, run the bucket-cname command to view the CNAME configurations of the bucket.

Notice Sample command lines in this topic are based on the 64-bit Linux system. For other systems, replace ./ossutil64 in the commands with the corresponding binary name. For more information, see ossutil.

Command syntax

./ossutil64 bucket-cname --method get oss://bucketname [local_xml_file]

The following table describes the parameters that you can configure when you run the bucket-cname command.

Parameter Description
bucketname The name of the bucket whose CNAME configurations you want to query.
local_xml_file The name of the local file used to store the CNAME configurations. Example: localfile.txt. If this parameter is not specified, the CNAME configurations that are obtained are directly displayed.

Examples

  • You can run the following command to query the CNAME configurations of the examplebucket bucket and write the configurations into the localfile.txt local file:
    ./ossutil64 bucket-cname --method get oss://examplebucket localfile.txt

    If a similar output is displayed, the CNAME configurations of the bucket are obtained:

    0.212407(s) elapsed
  • You can run the following command to query the CNAME configurations of the examplebucket bucket and specify that the output is displayed without being stored in the local file:
    ./ossutil64 bucket-cname --method get oss://examplebucket

    If a similar output is displayed, the CNAME configurations of the bucket are obtained. The following result shows that the example.com and example.org domain names are mapped to the examplebucket bucket and the domain names are enabled:

    <?xml version="1.0" encoding="UTF-8"?>
    <ListCnameResult>
      <Bucket>examplebucket</Bucket>
      <Owner>148562088256****</Owner>
      <Cname>
        <Domain>example.com</Domain>
        <LastModified>2021-08-26T07:25:12.000Z</LastModified>
        <Status>Enabled</Status>
        <IsPurgeCdnCache>true</IsPurgeCdnCache>
      </Cname>
      <Cname>
        <Domain>example.org</Domain>
        <LastModified>2021-08-26T07:25:26.000Z</LastModified>
        <Status>Enabled</Status>
        <IsPurgeCdnCache>true</IsPurgeCdnCache>
      </Cname>
    </ListCnameResult>
    
    0.164039(s) elapsed

Common options

To use ossutil to manage buckets that are located in different regions, you can use the -e option to use the endpoint of the specified bucket. To use ossutil to manage buckets that are owned by different Alibaba Cloud accounts, you can use the -i option to use the AccessKey ID of the specified account, and use the -k option to use the AccessKey secret of the specified account.

For example, you can run the following command to query the CNAME configurations of the examplebucket bucket that is located in the China (Hangzhou) region and is owned by another Alibaba Cloud account:

./ossutil64 bucket-cname --method get oss://testbucket  -e oss-cn-hangzhou.aliyuncs.com -i LTAI4Fw2NbDUCV8zYUzA****  -k 67DLVBkH7EamOjy2W5RVAHUY9H****

For more information about other common options that you can use for the bucket-cname command, see Common options.