Elastic Compute Service (ECS) functions as an important infrastructure for services. However, the deployment of ECS instances is limited to regions or countries. To address this issue, you can use ECS together with Dynamic Route for CDN (DCDN). DCDN and ECS help you deploy cost-effective, high-performance, and highly reliable networks and services. DCDN can accelerate the delivery of static and dynamic content on ECS instances, and provide computing and security services on edge nodes. You can deploy services across the world with a minimum number of ECS instances.

Background information

This section briefly introduces ECS and DCDN.
  • DCDN

    DCDN is a virtual network that consists of edge nodes. It accelerates content delivery and provides computing capabilities. You can use DCDN to accelerate the delivery of dynamic content or both static and dynamic content. DCDN supports a wide array of protocols, including HTTP, HTTPS, TCP, UDP, and WebSocket. DCDN has more than 2,800 nodes deployed across the world. These nodes provide protection and computing capabilities. For more information, see the DCDN documents.

  • ECS

    ECS is a scalable cloud service. It helps you minimize IT expenses and improve operation and maintenance (O&M) efficiency. This allows you to focus on the innovation of core services. For more information, see the ECS documents.

Scenarios

DCDN is suitable for various industries, including online education, gaming, retail, finance, media, and social media.
Online education Gaming Retail Finance Media Social media
  • APIs
  • Online examination
  • Online programming
  • Interactive whiteboards
  • Learning and examination reports
  • Uploads of images and audio content
  • Curriculum
  • Knowledge communities
  • Online chat
  • Online shops
  • APIs
  • Browser games
  • Turn-based games
  • Real-time interaction
  • Online multiplayer games
  • Deployment of game servers
  • In-game purchases
  • Online chat
  • Player rankings
  • Installation packages and resource plans
  • Online shops
  • APIs
  • Commodity search
  • Orders and transactions
  • Shipping updates
  • Online customer service
  • Promotional HTML5 pages
  • Sales promotions
  • Flash sales
  • Cross-border e-commerce
  • apps and websites
  • Financial transactions
  • Financial investments
  • Cross-border financial services
  • Financial markets
  • Financial news and information
  • Real-time quotation
  • SSL and VPN services for enterprises
  • Virtual desktops
  • IPv6 services
  • Websites and apps
  • News and information
  • Breaking news
  • Logon, registration, and query services
  • Personalized recommendations
  • Comments, replies, and likes
  • APIs
  • Online chat
  • File synchronization
  • Breaking news
  • Information graphics
  • Uploads of images and text
  • Comments and replies
  • Online shops
  • Likes and gifts
  • Personal information display

Benefits

DCDN provides the following benefits:
  • Acceleration of static and dynamic content

    Traditional CDN services can accelerate only static content delivery. DCDN can accelerate both static and dynamic content.

  • Compatibility with multiple protocols

    DCDN supports a wide array of protocols, including HTTP, HTTPS, WebSocket, TCP, and UDP. This allows you to accelerate content delivery at different layers.

  • Cost effectiveness

    DCDN minimizes expenses on ECS bandwidth, computing resources, and connections because content can be cached on distributed DCDN nodes.

  • High availability

    DCDN has more than 2,800 nodes deployed across the world. These nodes support a wide array of features such as protection and IPv6 to keep your services available and meet different business requirements.

  • Edge computing

    DCDN allows you to customize features such as A/B testing, URI rewrite, and rate limiting on edge nodes.

Architecture

The following figure shows how DCDN and ECS work with each other:Network topology
The user has created ECS instances in Region A and Region B. Applications are deployed on the ECS instances and Server Load Balancer (SLB) is used to balance loads. DCDN is used to accelerate the delivery of content on the ECS instances. After a domain name is added to DCDN, static content and dynamic content requested by users are intelligently identified by DCDN. Then, DCDN accelerates the delivery of static content or both static and dynamic content.
  • Accelerate the delivery of static content

    Static content is cached on DCDN nodes. Users can retrieve static content from the nearest nodes.

  • Accelerate the delivery of dynamic content

    If content requested by some requests, such as POST requests, is not cached on DCDN nodes, DCDN nodes redirect the requests to the origin server to retrieve content based on an intelligent scheduling system. The system selects an optimal route for redirection.

  • Accelerate the delivery of both dynamic and static content

    DCDN intelligently identifies static and dynamic content. Static content is cached on DCDN nodes. Users can directly retrieve the cached static content from the nearest DCDN nodes. Requests for dynamic content are redirected to the origin server through an optimal route selected by the intelligent scheduling system.

Configuration procedure

Prerequisites

Before you start, make sure that the following requirements are met:
  • An ECS instance is created and applications are deployed on it. The ECS instance is assigned a public IP address. If you have configured an SLB instance for the ECS instance, make sure that the SLB instance is assigned a public IP address and can provide services to external systems.
  • A domain name with a valid Internet Content Provider (ICP) number is prepared. If the domain name does not have an ICP number, you can apply for one through Alibaba Cloud ICP Filing System.
  • DCDN is activated. For more information about how to activate DCDN, see Activate DCDN.

Procedure

Configuration procedure

Basic settings (required)

Step 1: Add a domain name to DCDN

  1. Log on to the DCDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, click Add Domain Name.
  4. On the Add Domain Name page, set the following parameters.
    Add a domain name to DCDN
    Action Description
    Domain Name to Accelerate
    Take note of the following rules:
    • The domain name to be accelerated can be a subdomain name or a wildcard domain name. The domain name must be in lowercase letters. Chinese characters are not supported.

      If the domain name is example.com, the domain name to be accelerated can be a subdomain name of example.com, for example, cdntest.example.com.

    • You can specify a wildcard domain name, such as *.example.com. For more information about the rules for wildcard domain names, see Does DCDN support acceleration for wildcard domain names?.
      Note
      • A wildcard domain name and the domain names that match the wildcard domain name must be added to DCDN by the same Alibaba Cloud account. The system checks the domain names when you add them to DCDN. If a wildcard domain name and the domain names that match the wildcard domain name are added to DCDN by different Alibaba Cloud accounts, an error message is returned. To request technical support from Alibaba Cloud, submit a ticket.
      • If a wildcard domain is not added to DCDN, you can add the domain names that match the wildcard domain name to DCDN with different Alibaba Cloud accounts.
    • You cannot add a duplicate domain name to DCDN.

      If the DomainAlreadyExist error occurs, check whether the domain name is added to other Alibaba Cloud services such as ApsaraVideo VOD, ApsaraVideo Live, Alibaba Cloud CDN (CDN), Secure CDN (SCDN), and Video Surveillance System. You can submit a ticket to report this issue.

    • You can add at most 50 domain names to Alibaba Cloud CDN with each Alibaba Cloud account.

      However, if the sum of the average daily peak bandwidth values of your domain names exceeds 50 Mbit/s, you can submit a ticket to add more domain names to Alibaba Cloud CDN. Make sure that the increase of domain names does not cause business risks.

    • The content delivered from the domain name must be legal and comply with the Terms of Service for DCDN. For more information, see Limits.
    Resource Group Select Default Resource Group or a custom resource group. For more information about how to create a resource group, see Create a resource group.
    Business Type Select DCDN.
    Acceleration Region Mainland China Only is selected in this example. If you select Mainland China Only or Global, you must apply for an ICP number for the domain name. We recommend that you use Alibaba Cloud ICP Filing System to apply for ICP numbers. You must wait for a period of time before data is updated in the database of the Ministry of Industry and Information Technology (MIIT). After you submit domain name information to MIIT, we recommend that you wait 8 hours before you configure the domain name in DCDN.
    Note The pricing varies based on the accelerated region. Select an accelerated region based on your business requirements. For more information about the pricing of DCDN, see DCDN Pricing.
  5. On the Add Domain Name page, click Add Origin Server and set the following parameters.
    Add Origin Server
    Parameter Description
    Type
    • OSS Domain

      If you select OSS Domain, you can enter the public domain name of an Alibaba Cloud Object Storage Service (OSS) bucket in the Domain Name field. For example, you can enter xxx.oss-cn-hangzhou.aliyuncs.com. Internal endpoints of OSS buckets are not supported.

      You can view the public endpoint of an OSS bucket in the OSS console. You can also select an OSS bucket that belongs to the current Alibaba Cloud account from the Domain Name drop-down list.

    • IP

      If you select IP, you can enter the public IP address of the origin server in the IP field.

      Enter the public IP addresses of one or more servers. Public IP addresses of Alibaba Cloud Elastic Compute Service (ECS) instances do not need to be reviewed.

    • Site Domain
      If you select Site Domain, you can enter the domain name of your origin server in the Domain Name field.
      Note The origin domain name cannot be the same as the accelerated domain name. Otherwise, a DNS resolution loop occurs, and requests cannot be redirected to the origin server.
    Priority

    You can set priorities to specify primary and secondary origin servers. The primary origin server has a higher priority than secondary origin servers. DCDN preferentially redirects requests to the primary origin server.

    For example, if you set Origin Server A and B as the primary and secondary origin server, user requests are preferentially redirected to Origin Server A. If Origin Server A is down, user requests are redirected to Origin Server B until Origin Server A works as expected again.

    Weight

    If origin servers have the same priority, DCDN redirects requests to the origin servers based on their weights. This balances loads among the origin servers. Valid values of weights are 0 to 100. An origin server with a greater weight value receives a larger number of requests.

    For example, you have specified two origin servers: Server A and Server B, and both of them are primary origin servers. The weight of Server A is 80, and the weight of Server B is 20. In this case, DCDN redirects 80% of requests to Server A and 20% of requests to Server B.

    Port
    Select a port based on the protocol supported by the origin server.
    • Port 80: Requests are redirected to port 80 of the origin server.
    • Port 443: Requests are redirected to port 443 of the origin server. Make sure that the origin server supports HTTPS.
    Note Before you can specify a custom port, you must set Static Origin Protocol Policy and Dynamic Origin Protocol Policy to HTTP after you add a domain name. For more information, see Configure the static origin protocol policy and Configure back-to-origin requests to retrieve dynamic content.
  6. Click Next.
    The first time a domain name is added to the DCDN console, the ownership of the domain name must be checked. If the domain name has already passed the verification, skip this step. For more information, see Verify the ownership of a domain name.
  7. Wait for manual verification.

    After the domain name passes the verification, you can check the status of the domain name on the Domain Names page. If the domain name is in the Enabled state, it indicates that the domain name is added to Alibaba Cloud CDN.

Step 2: Run tests (optional)

After you add a domain name to DCDN, we recommend that you test whether the domain name is accessible before you update the Canonical Name (CNAME) record of the domain name. This ensures that DNS updates do not affect the services of the domain name.
Note During the test, requests are sent to DCDN nodes. You are charged for the basic services and value-added services that you have used. The billing rules of DCDN apply in the test. For more information, see Overview.
  1. Obtain the CNAME that is assigned to the domain name.
    1. Log on to the DCDN console.
    2. In the left-side navigation pane, click Domain Names.
    3. On the Domain Names page, copy the CNAME of the domain name.
      Note We recommend that you copy the CNAME of the domain name that is in the Normal state.
      Copy CNAME
  2. Obtain the IP address of the CNAME.
    Note The following IP address is an example retuned by running the ping command and is for reference only. To obtain the actual IP address of your CNAME, run the ping command to ping your CNAME.
    • Windows: To obtain the IP address of your CNAME, open the command-line interface and run the ping command to ping your CNAME.
    • macOS: To obtain the IP address of your CNAME, open the command-line interface and run the dig command to dig your CNAME. MAc dig CNAME
  3. Add the IP address and domain name to the hosts file of the on-premises machine.

    You must add the IP address obtained from Step 2 and the accelerated domain name to the hosts file of the on-premises machine. Make sure that you add the IP address before the accelerated domain name.

    In this example, the accelerated domain name is example.com, the CNAME is example.com.w.kunlunsl.com, and the IP address of the CNAME is 203.0.113.1.

    • The path of the hosts file in Windows is C:\Windows\System32\drivers\etc\hosts. The following figure is an example. Example
    • The path of the hosts file in macOS is Finder>Go>Go to the folder>/etc/hosts. The following figure is an example. The hosts file
  4. Test whether the accelerated domain name is accessible.
    After you add the IP address and accelerated domain name to the hosts file, you can open the browser and enter the accelerated domain name in the address bar to test the connectivity. You can view the test result by using the developer tool of the browser.
    • If the IP address in the Remote Address field is the same as the one that you add to the hosts file, it indicates that the configuration is valid. You can configure the CNAME on the DNS service provider side. Test the connectivity of the website
    • If the IP address in the Remote Address field is different from the one that you add to the hosts file, it indicates that the configuration is invalid. Make sure that you add the IP address of the CNAME to the hosts file.

    After you access the accelerated domain name, you can also test other features by using the on-premises machine.

Step 3: Add a CNAME record

You must add CNAME records in the system of your DNS service provider. Alibaba Cloud DNS is used in this example to demonstrate how to add CNAME records. The procedure for adding CNAME records in the system of a third-party DNS service provider is similar.

  1. Obtain the CNAME that is assigned to the domain name.
    1. Log on to the DCDN console.
    2. In the left-side navigation pane, click Domain Names.
    3. On the Domain Names page, copy the CNAME of the domain name.
      CNAME 01
  2. Add a CNAME record for the domain name.
    1. Log on to the Alibaba Cloud DNS console.
    2. On the Manage DNS page, find the domain name that you want to manage and click Configure in the Actions column.
    3. Click Add Record to add a CNAME record.
      Note
      • The CNAME record of a specific domain name takes precedence over that of a wildcard domain name. If the domain name to be accelerated is a wildcard domain name, and the host record includes an asterisk (*), you must delete all effective DNS records of the second-level domain names that match the wildcard domain name.
      • If the CNAME record that you want to use conflicts with an existing DNS record, we recommend that you use another domain name or modify the DNS record.
      Add a CNAME record
      Parameter Description Example
      Type Select CNAME from the drop-down list. CNAME
      Host Enter the prefix of the domain name.
      • If the domain name to be accelerated is testcdn.aliyun.com, enter testcdn.
      • If the domain name to be accelerated is www.aliyun.com, enter www.
      • If the domain name to be accelerated is aliyun.com, enter @.
      • If the domain name to be accelerated is *.aliyun.com, enter *.
      ISP Line Specify the default ISP line. Keep the default setting.
      Value
      Enter the CNAME that is assigned to the domain name.
      Note Each domain name is assigned a unique CNAME. Second-level domain names cannot use the CNAME of the top-level domain name. If you want to accelerate a second-level domain name, you must add the domain name to DCDN and resolve the domain name to the CNAME that you want to use. The CNAME of a wildcard domain name can be used by a second-level domain name. Therefore, you can also add a wildcard domain name to DCDN. For more information, see Add a domain name.
      all.example.com.w.kunlunsl.com
      TTL Enter a time-to-live (TTL) value for the CNAME record. A smaller value specifies a shorter time to apply record updates. The default TTL value is 10 minutes. Keep the default setting.
    4. Click OK.
      After the CNAME record takes effect, the domain name is immediately accelerated. After you add a CNAME record, the CNAME record immediately takes effect. After you modify a CNAME record, the modifications take effect within 72 hours. After you add a CNAME record, the system takes approximately 10 minutes to update the status in the DCDN console. During this process, a message may appear, which prompts you to add a CNAME record. Ignore the message.

Step 4: Verify that the CNAME record works as expected

  1. Open Command Prompt in Windows.
  2. Run the ping command to ping the domain name. If the CNAME in the output is the same as the CNAME that is assigned to the domain name, it indicates that acceleration is enabled for the domain name.
    Check whether the CNAME record takes effect

Advanced settings (optional)

After you enable DCDN to accelerate the delivery of content on the ECS instance, you can configure advanced settings based on business requirements.
Scenario Description Feature Reference
Accelerate the delivery of both static and dynamic content After you enable acceleration for dynamic content delivery, DCDN automatically identifies dynamic content and static content. Static content such as images, Sitecore JavaScript SDK (JSS) code, and CSS code is cached on DCDN nodes so that users can retrieve content from the nearest DCDN nodes. For requests that request dynamic content, such as POST requests, DCDN selects an optimal route to redirect the requests to the origin server to retrieve the requested content. Enable acceleration for dynamic content delivery

To enable acceleration for dynamic content delivery,

navigate to the > Acceleration Rules > Dynamic Acceleration page.
Accelerate content delivery in more regions If the majority of your users and the ECS instances are located in mainland China, you can set the accelerated region to Mainland China Only. As your business develops, your users may be located around the world. If requests from your users are all sent to DCDN nodes that are deployed in mainland China, content delivery can be slow. In this case, you can change the accelerated region to Global. Requests can be scheduled to nodes that are nearest to the users. Change the accelerated region Modify basic information
Balance loads on origin servers DCDN can redirect requests to primary and secondary origin servers based on the round-robin algorithm to balance loads on the origin servers. In addition, DCDN can automatically switch to another origin server when an error occurs on one origin server.
This feature is applicable to the following scenarios:
  • Switch from one ECS instance to another ECS instance that is deployed in a different zone but in the same region. For example, you can switch from an ECS instance in Beijing Zone A to an ECS instance in Beijing Zone B.
  • Switch from one ECS instance to another ECS instance that is deployed in a different region. For example, you can switch from an ECS instance in the China (Beijing) region to an ECS instance in the China (Qingdao) region.
  • Switch from one cloud service provider to another cloud service provider. For example, you can switch from Alibaba Cloud to Tencent Cloud.
  • Switch from cloud services to data centers.
Specify primary and secondary origin servers Configure an origin server
Meet requirements such as DNS settings, latency, and availability You can enable the IPv6 feature to meet business requirements, including DNS settings, latency, and availability. Enable IPv6 Configure IPv6

For more information about DCDN, see What is DCDN?