You can bind your domain name to an API Group hosted on API Gateway. API Gateway locates a unique API group by domain name and locates a unique API operation in the API group by using Path and HTTPMethod.

API Gateway provides a default Internet second-level domain name for each API group. A client can directly call the Internet second-level domain name up to 1,000 times per day. When you publish APIs in a production environment, you must bind an independent domain name to the target API group. The number of API calls is not limited for independent domain names.

An independent domain name that you want to bind to an API group must meet the following requirements:

  • You must apply for an ICP filing or access the independent domain name atAlibaba Cloud ICP Filing.
  • Before you bind the independent domain name to the target API group, you must add a CNAME record for the independent domain name to the second-level domain name of the group.
  • The independent domain name has not been bound to an API group hosted on API Gateway by other users. If the independent domain name has been bound by other users, it must be verified when you attempt to bind it. If the API operations under the API group need to support HTTPS, you must import or upload an SSL certificate for the independent domain name.

1. Procedure for binding a domain name to an API group

To bind your domain name to an API group hosted on API Gateway, follow these steps:

  • Log on to the API Gateway console and bind your domain name to the target API group.
  • Add a CNAME record for your domain name to the Internet second-level domain name provided by API Gateway to switch the traffic.

1.1 Bind a domain name to an API group

1. Log on to the API Gateway console. In the left-side navigation pane, click API Groups. On the page that appears, click the group to which you want to bind the domain name. The Group Details page appears.

2. In the lower-right part of the Group Details page, click Bind Domain.

3. In the Bind Domain Name dialog box, enter your domain name and click OK.

1.2 Add a CNAME record for a domain name

To add a CNAME record for your domain name to the Internet second-level domain name provided by API Gateway, follow these steps:

1. On the Group Details page, view Internet Subdomain of the group.

2. Log on to your DNS management platform. If you use Alibaba Cloud DNS, visithttps://dns.console.aliyun.com.On the Manage DNS page of the Alibaba Cloud DNS console, click the target domain name to go to the DNS Settings page.

3. Add or modify a record for the domain name that you want to bind to the API group.

4. In the Add Record or Edit Record dialog box, set Type to CNAME and Value to the Internet second-level domain name that you obtained in step 2.

5. Click OK. After binding is complete, you can view the bound second-level domain name on the DNS Settings page.

2. Procedure for uploading an SSL certificate for a domain name

After the binding is complete, you can use the bound domain name to call API operations under the API group in HTTP mode. If you want to call the API operations in HTTPS mode, you must upload an SSL certificate for the domain name. The certificate can be uploaded in either of the following ways: API Gateway automatically imports an SSL certificate from the Alibaba Cloud SSL Certificates Service or allows you to manually upload the SSL certificate that you obtained from other certificate service providers.

2.1 Generate an SSL certificate for a domain name

To generate a free SSL certificate by using the Alibaba Cloud SSL Certificates Service, follow these steps:

1. Log on to theAlibaba Cloud SSL Certificates console.

2. On the SSL Certificates page, click Purchase Certificate. On the page that appears, purchase an SSL certificate and bind your domain name to the certificate. For more information about how to purchase an SSL certificate, seeDocumentationof the Alibaba Cloud SSL Certificates Service. After you apply for an SSL certificate, go to the Group Details page of the target API group in the API Gateway console.

2.2 Import or upload the SSL certificate for the domain name

After you purchase or prepare a SSL certificate, import or upload the certificate for the domain name that you bound to the target API group in the API Gateway console. The following sections describe the certificate import and upload procedures.

2.2.1 Import an SSL certificate

If you purchase a certificate by using the Alibaba Cloud SSL Certificates Service, follow these steps to import the certificate for the domain name that you bound to the target API group hosted on API Gateway:

1. Go to the Group Details page of the API Gateway console. In the list of bound domain names, find the target domain name and click Select Certificate in the SSL Certificate column.

2. In the Select Certificate dialog box, click Search Certificate. Then, select the required certificate from the search results and click Synchronization certificate.

2.2.2 Upload an SSL certificate

If your SSL certificate is not purchased from Alibaba Cloud, you can also upload your certificate to API Gateway. To upload the SSL certificate, follow these steps:

1. Go to the Group Details page of the API Gateway console. In the list of bound domain names, find the target domain name and click Select Certificate in the SSL Certificate column.

2. In the Select Certificate dialog box, click Create Certificate.

3. In the dialog box that appears, enter required information as prompted. 4. After the certificate is uploaded, go to the Group Details page. You can see that Select Certificate in the SSL Certificate column changes to Update Certificate.

After the certificate is uploaded, you can access the target domain name by using HTTPS.