All Products
Search
Document Center

Object Storage Service:create-cname-token

Last Updated:Sep 11, 2024

Creates a CNAME token to verify the ownership of the domain name.

Usage notes

By default, an Alibaba Cloud account has the permissions to create a CNAME token to verify the ownership of the domain name. To create a CNAME token to verify the ownership of the domain name by using a RAM user or Security Token Service (STS), you must have the oss:CreateCnameToken permission. For more information, see Attach a custom policy to a RAM user.

Command syntax

ossutil api create-cname-token --bucket value --cname-configuration value [flags]

Parameter

Type

Description

--bucket

string

The name of the bucket to which the domain name is mapped.

--cname-configuration

string

The container that stores the CNAME record.

Note

The create-cname-token command corresponds to the CreateCnameToken operation. For more information about the parameters in the CreateCnameToken operation, see CreateCnameToken.

--cname-configuration

The --cname-configuration option supports both the XML and JSON format. If the value of the option contains the file:// prefix, ossutil reads configurations from a configuration file.

  • XML format:

    <BucketCnameConfiguration>
      <Cname>
        <Domain>string</Domain>
      </Cname>
    </BucketCnameConfiguration>
  • JSON format:

    {
      "Cname": {
        "Domain": "string"
      }
    }
Note

For more information about supported global command-line options, see Global command-line options.

Examples

The following examples show how to create a CNAME token to verify the ownership of example.com mapped to the examplebucket bucket.

  • Create a configuration file named cname-configuration.xml and add the following code to the configuration file:

    <?xml version="1.0" encoding="UTF-8"?>
    <BucketCnameConfiguration>
      <Cname>
        <Domain>example.com</Domain>
      </Cname>
    </BucketCnameConfiguration>

Sample command:

ossutil api create-cname-token --bucket examplebucket --cname-configuration file://cname-configuration.xml
  • Create a configuration file named cname-configuration.json and add the following code to the configuration file:

    {
      "Cname": {
        "Domain": "example.com"
      }
    }

    Sample command:

    ossutil api create-cname-token --bucket examplebucket --cname-configuration file://cname-configuration.json
  • Configure parameters in the following command in the JSON format:

    ossutil api create-cname-token --bucket examplebucket --cname-configuration "{\"Cname\":{\"Domain\":\"example.com\"}}"