All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::CDN::Domain

Last Updated:Dec 11, 2023

ALIYUN::CDN::Domain is used to add a domain name to Alibaba Cloud CDN (CDN).

Note
  • Before you add a domain name to CDN, you must activate CDN. For more information, see Activate Alibaba Cloud CDN.

  • The domain name must be ICP filed.

  • You can add only a single domain name to CDN in each call. You can add up to 50 domain names by using an Alibaba Cloud account.

  • If the content of the origin server is not stored on Alibaba Cloud, the content must be reviewed. The review will be completed by the end of the next business day after you submit the application.

  • The maximum number of times that each user can call this operation per second is 30.

Syntax

{
  "Type": "ALIYUN::CDN::Domain",
  "Properties": {
    "CdnType": String,
    "Sources": String,
    "CheckUrl": String,
    "DomainName": String,
    "ResourceGroupId": String,
    "Scope": String,
    "TopLevelDomain": String,
    "Tags": List,
    "OriginServers": List
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

CdnType

String

Yes

No

The workload type of the accelerated domain name.

Valid values:

  • web: images and small files

  • download: downloads of large files

  • video: on-demand video and audio streaming

Sources

String

No

Yes

The addresses of the origin servers.

Example: [{"content":"1.1.1.1","type":"ipaddr","priority":"20","port":80,"weight":"15"}].

CheckUrl

String

No

No

The URL that is used to check the accessibility of the origin server.

Example: example.com/test.html.

DomainName

String

Yes

No

The domain name that you want to add to CDN.

Wildcard domain names are supported. The domain name must start with a period (.).

Example: .example.com.

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

Scope

String

No

No

The accelerated region.

Valid values:

  • domestic (default): inside the Chinese mainland

  • overseas: outside the Chinese mainland

  • global: global

TopLevelDomain

String

No

Yes

The top-level domain.

Example: www.yourTopLevelDomain.

Tags

List

No

Yes

The tags.

You can specify up to 20 tags.

For more information, see Tags properties.

OriginServers

List

No

No

The source servers.

The OriginServers property has the same effect as the Sources property. However, the OriginServers property takes precedence over the Sources property. You can specify up to 20 source servers. For more information, see OriginServers properties.

Tags syntax

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. The tag key cannot start with aliyun or acs:.

Value

String

No

No

The tag value.

The tag value can be up to 128 characters in length and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

OriginServers syntax

"OriginServers": [
  {
    "Port": Integer,
    "Weight": String,
    "Priority": String,
    "Content": String,
    "Type": String
  }
]  

OriginServers properties

Property

Type

Required

Editable

Description

Constraint

Port

Integer

Yes

No

The port.

You can specify port 443, port 80, or a custom port. Default value: 80. If you specify port 443, CDN communicates with the origin server over HTTPS.

Weight

String

No

No

The weight of the origin server if multiple origin servers are specified.

Valid values: a numeric value that is less than 100. Default value: 10.

Priority

String

No

No

The priority of the origin server if multiple origin servers are specified.

Valid values: 20 and 30. Default value: 20. A value of 20 specifies that the origin is a primary origin. A value of 30 specifies that the origin is a secondary origin.

Content

String

Yes

No

The address of the origin server.

You can specify an IP address or a domain name.

Type

String

Yes

No

The type of the origin server.

Valid values:

  • ipaddr: The origin server is configured by using an IP address

  • domain: The origin server is configured by using a domain name.

  • oss: The origin server is configured by using the public domain name of an Object Storage Service (OSS) bucket.

  • fc_domain: The origin server is configured by using a Function Compute domain name.

Return values

Fn::GetAtt

  • DomainName: the domain name that is added to CDN.

  • Cname: the alias of the CDN domain name. A Canonical Name (CNAME) record is provided to the Domain Name System (DNS) to map the alias to the canonical name.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
 CdnType:
  AllowedValues:
  - video
  - download
  - web
  - liveStream
  Description: 'The business type. Valid values: web, download, video, livestream,
   and httpsdelivery. web: acceleration of images and small files download. download:
   acceleration of large file downloads. video: live streaming acceleration. httpsdelivery:
   SSL acceleration for HTTPS.'
  Type: String
 CheckUrl:
  Description: The validation of the origin.
  Type: String
 DomainName:
  Description: The CDN domain name. Wildcard domain names that start with periods
   (.) are supported. For example, .example.com.
  Type: String
 ResourceGroupId:
  Description: The ID of the resource group. If this is left blank, the system automatically
   fills in the ID of the default resource group.
  Type: String
 Scope:
  Description: 'Valid values: domestic, overseas, and global. Default value: domestic.
   The setting is supported for users outside mainland China, users in mainland
   China of level 3 or above.'
  Type: String
 Sources:
  Description: The list of origin URLs.
  Type: String
 Tags:
  Description: Tags to attach to instance. Max support 20 tags to add during create
   instance. Each tag with two properties Key and Value, and Key is required.
  MaxLength: 20
  Type: Json
 TopLevelDomain:
  Description: The top-level domain, which can only be configured by users on the
   whitelist.
  Type: String
Resources:
 Domain:
  Properties:
   CdnType:
    Ref: CdnType
   CheckUrl:
    Ref: CheckUrl
   DomainName:
    Ref: DomainName
   ResourceGroupId:
    Ref: ResourceGroupId
   Scope:
    Ref: Scope
   Sources:
    Ref: Sources
   Tags:
    Ref: Tags
   TopLevelDomain:
    Ref: TopLevelDomain
  Type: ALIYUN::CDN::Domain
Outputs:
 Cname:
  Description: The CNAME generated for the CDN domain.You must add a CNAME record
   with your DNS provider to map the CDN domain name to the CNAME.
  Value:
   Fn::GetAtt:
   - Domain
   - Cname
 DomainName:
  Description: The CDN domain name. Wildcard domain names that start with periods
   (.) are supported. For example, .example.com.
  Value:
   Fn::GetAtt:
   - Domain
   - DomainName

JSON format

{
 "ROSTemplateFormatVersion": "2015-09-01",
 "Parameters": {
  "CheckUrl": {
   "Type": "String",
   "Description": "The validation of the origin."
  },
  "ResourceGroupId": {
   "Type": "String",
   "Description": "The ID of the resource group. If this is left blank, the system automatically fills in the ID of the default resource group."
  },
  "Scope": {
   "Type": "String",
   "Description": "Valid values: domestic, overseas, and global. Default value: domestic. The setting is supported for users outside mainland China, users in mainland China of level 3 or above."
  },
  "DomainName": {
   "Type": "String",
   "Description": "The CDN domain name. Wildcard domain names that start with periods (.) are supported. For example, .example.com."
  },
  "CdnType": {
   "Type": "String",
   "Description": "The business type. Valid values: web, download, video, livestream, and httpsdelivery. web: acceleration of images and small files download. download: acceleration of large file downloads. video: live streaming acceleration. httpsdelivery: SSL acceleration for HTTPS.",
   "AllowedValues": [
    "video",
    "download",
    "web",
    "liveStream"
   ]
  },
  "TopLevelDomain": {
   "Type": "String",
   "Description": "The top-level domain, which can only be configured by users on the whitelist."
  },
  "Sources": {
   "Type": "String",
   "Description": "The list of origin URLs."
  },
  "Tags": {
   "Type": "Json",
   "Description": "Tags to attach to instance. Max support 20 tags to add during create instance. Each tag with two properties Key and Value, and Key is required.",
   "MaxLength": 20
  }
 },
 "Resources": {
  "Domain": {
   "Type": "ALIYUN::CDN::Domain",
   "Properties": {
    "CheckUrl": {
     "Ref": "CheckUrl"
    },
    "ResourceGroupId": {
     "Ref": "ResourceGroupId"
    },
    "Scope": {
     "Ref": "Scope"
    },
    "DomainName": {
     "Ref": "DomainName"
    },
    "CdnType": {
     "Ref": "CdnType"
    },
    "TopLevelDomain": {
     "Ref": "TopLevelDomain"
    },
    "Sources": {
     "Ref": "Sources"
    },
    "Tags": {
     "Ref": "Tags"
    }
   }
  }
 },
 "Outputs": {
  "DomainName": {
   "Description": "The CDN domain name. Wildcard domain names that start with periods (.) are supported. For example, .example.com.",
   "Value": {
    "Fn::GetAtt": [
     "Domain",
     "DomainName"
    ]
   }
  },
  "Cname": {
   "Description": "The CNAME generated for the CDN domain.You must add a CNAME record with your DNS provider to map the CDN domain name to the CNAME.",
   "Value": {
    "Fn::GetAtt": [
     "Domain",
     "Cname"
    ]
   }
  }
 }
}

For more examples, visit Domain.json and Domain.yml. In the examples, the ALIYUN::CDN::Domain and ALIYUN::CDN::DomainConfig resource types are used.