All Products
Search
Document Center

CDN:ROS integration example

Last Updated:Jun 22, 2026

Use Resource Orchestration Service (ROS) to call Alibaba Cloud CDN operations. Write a ROS template to automatically add an Alibaba Cloud CDN accelerated domain name.

Supported resources

Resource Orchestration Service (ROS) simplifies cloud resource management. You can write templates to define Alibaba Cloud resources, such as ECS instances and RDS database instances, and their dependencies. The ROS orchestration engine automatically creates and configures all defined resources for automated deployment and O&M. For more information, see What is Resource Orchestration Service.

ROS supports the following Alibaba Cloud CDN resource types: regular resources and data source resources.

Permissions

This example adds an accelerated domain name. By default, Resource Orchestration Service uses the credentials of the current user, who must have the following permissions:

  • AliyunCDNFullAccess: Grants full access to Alibaba Cloud CDN resources.

For security, use a RAM user instead of your Alibaba Cloud account for API access and routine O&M. The RAM user must have permissions to manage Alibaba Cloud CDN resources. For more information, see System policies for Alibaba Cloud CDN.

Procedure

Procedure

  1. Log on to the ROS console. In the top navigation bar, select the desired region from the region drop-down list.

  2. In the left-side navigation pane, click Stacks. Then, choose Create Stack > Use ROS.

    • Specify Template: Select Select an Existing Template.

    • Template Import Method: Select Enter Template Content.

  3. For Template Content, select ROS and enter the code.

    For the syntax and parameters, see ALIYUN::CDN::Domain.

    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 for image and small file downloads. download:
       acceleration for 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 the instance. Up to 20 tags can be added when the instance is created. A tag consists of a Key and a Value, and the 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 for image and small file downloads. download: acceleration for 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 the instance. Up to 20 tags can be added when the instance is created. A tag consists of a Key and a Value, and the 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"
        ]
       }
      }
     }
    }
  4. Click Next.

  5. On the Configure Parameters page, set the parameters and click Create.

  6. Check the stack status.

    The Status of the stack changes to CREATE_COMPLETE, and the status description is Stack CREATE completed successfully.

  7. After the stack is created, verify the resource creation by using an API, an SDK, or the Alibaba Cloud CDN console.

    In the Alibaba Cloud CDN console, go to the Domain Management page. The new accelerated domain name appears with a status of Enabled and a CNAME status of Configured.