You can enable Alibaba Cloud CDN (CDN) acceleration for an application deployed in Function Compute, so that users can obtain the content they need. This topic describes how to enable CDN acceleration for an application in Function Compute.

Prerequisites

Bind a custom domain name

You can enable CDN acceleration when or after you bind a custom domain name to an application. In this topic, it is assumed that you have bound a domain name to your application.

Background information

Alibaba Cloud CDN is a distributed network that is built over the bearer network and consists of edge nodes deployed in different regions. CDN can prevent network congestion by distributing the workload of an origin among edge nodes. You can use CDN to accelerate website content delivery in different regions and scenarios, ensuring that users can access resources at a high speed. For more information, see Alibaba Cloud CDN.

You can enable CDN acceleration for a web application in Function Compute. A web application deployed in Function Compute is an origin, and its source content is delivered to edge nodes. The precise scheduling system of CDN distributes user requests to the most appropriate nodes, ensuring that users can obtain the content they need at the minimum latency.

Notice The CDN acceleration feature incurs Internet data transfer fees. For more information, see billing methods.

Function Compute serves as a backend application of CDN. To enable CDN acceleration, you must bind a custom domain name to your web application in the Function Compute console. This custom domain name is used as the origin domain name. Then, you add a domain name to accelerate to the custom domain name and configure a canonical domain name (CNAME) for the domain name to accelerate. The following content describes the related definitions:

  • The domain name to accelerate is the domain name for which you use CDN to accelerate content delivery.
  • The origin domain name is the domain name that is used for your services.
Schematic-diagram

Step 1: Add a domain name to accelerate

  • Method 1: Add a domain name to accelerate in the Function Compute console.
    1. Log on to the Function Compute console.
    2. In the top navigation bar, select your region.
    3. In the left-side navigation pane, click Custom Domain.
    4. In the domain name list, find the target domain name, and click Update in the Actions column.
    5. In the Update Custom Domain dialog box, turn on CDN Acceleration. Enter a domain name to accelerate in the Accelerated Domain field and click OK.enable-accelerate-domain
      Note You can configure multiple domain names to accelerate for one custom domain name.
      Log on to the CDN console. In the left-side navigation pane, click Domain Names. On the Domain Names page, you can view the domain name to accelerate that you created.accelerate-domain
  • Method 2: Add a domain name to accelerate in the CDN console.

    For information about how to enable CDN acceleration in the CDN console, see Add a domain name for CDN.

    When you add a domain name to accelerate, select Function Compute Domain for Origin Info. Then, select the region where your Function Compute service is located and select the custom domain name that you created in the Function Compute console.

    After you add the domain name to accelerate, you can use the Function Compute console to verify that CDN acceleration is enabled for your custom domain name and that the specified domain name to accelerate is bound to it. To verify the results, perform the following operations:

    1. Log on to the Function Compute console.
    2. In the top navigation bar, select your region.
    3. In the left-side navigation pane, click Custom Domain.
    4. In the list of custom domain names, find the target domain name, and click Update in the Actions column.
    5. In the Update Custom Domain dialog box, you can confirm that the CDN acceleration settings have been synchronized from the CDN console.result-accelerate-domain

Step 2: Configure a CNAME for the domain name to accelerate

For information about how to configure a CNAME for a domain name to accelerate, see Configure a CNAME record for CDN.