☁️How to Serve Website with Huawei Cloud CDN

Mücahid Özçelik
Huawei Developers
Published in
5 min readApr 4, 2023

--

CDN

Introduction

Hello everyone 😊 , In this article describes how to configure static website hosting for buckets and use with Huawei Cloud CDN to access static websites 💻.

What Is HUAWEI CLOUD CDN?

🎈HUAWEI CLOUD CDN has over 2000 edge nodes in the Chinese mainland and over 800 edge nodes outside the Chinese mainland. The network-wide bandwidth is at least 150 Tbit/s. The edge nodes are connected to the networks of top carriers in China such as China Telecom, China Unicom, China Mobile, and China Education and Research Network (CERNET), as well as many small- and medium-sized carriers. Up to now, HUAWEI CLOUD CDN covers more than 130 countries and regions, connecting to over 1600 carrier networks. CDN precisely schedules user requests to the most appropriate edge nodes, efficiently accelerating content delivery.

Prerequisites

Make sure that buy a domain name because we need to domain name for this practice. For example , I bought www.testcloud.club domain name 📌 .

After you completed the prerequisites, you are all set for the instructions.

Service Details

Now let’s make a practice🚀. For this practice, we will follow the architecture .

Architecture Diagram

We will follow the 4 steps below .

1. Create OBS Bucket

2. Create Test Certificate at CCM

3. Create Public Zone at DNS

4. Add Domain Name to CDN

1.Create OBS Bucket

Firstly , we need to create an Huawei Cloud OBS Bucket. The bucket policy should be public read and configure static website hosting for the bucket to host these files. You can upload the content files of static websites to your bucket on OBS .

Huawei Cloud OBS

I wrote a one page website html codes at testcloud.html . Then upload testcloud.html the created bucket .

OBS Bucket

Basic Configuration > Static Website Hosting

OBS Bucket Configuration

2. Create Test Certificate at CCM

Huawei Cloud Certificate Managament Service(CCM) helps you implement HTTPS for websites by getting SSL certificates from a certificate authority (CA), making your website more secure and trustworthy. I create a test certificate at Cloud Certificate Management Service.

Huawei Cloud Certificate Manager
SSL Certificate

After creating the certificate apply for certificate .

Apply Certificate
Apply Certificate

Test certificate created successfully .

Apply Certificate

Then go DNS and record the certificate with record value.

Record Value

3. Create Public Zone at DNS

Huawei Cloud Domain Name Service (DNS) provides authoritative, scalable, and high available DNS services. It translates domain names (such as www.example.com) into IP addresses (such as 192.1.2.3) required for network connection. The DNS service allows users to visit your websites or web applications with domain names.

The Huawei Cloud DNS service is free and is enabled by default.

Public Zone ,

The DNS service helps you map domain names to public IP addresses so that visitors can access your website or web applications over the Internet.

I created public zone for www.testcloud.club at Huawei Cloud Domain Name Service.

Public Zone

Save the marked values to the provider where you purchased the domain name.

DNS Values
Save DNS Values

DNS > Public Zones > testcloud.club > Add Record Set

Adding record in DNS for the domain name to be verify .

Add Record
Huawei Cloud DNS

4. Add Domain Name to CDN

Huawei Cloud Content Delivery Network (CDN) is an intelligent virtual network built on top of existing Internet infrastructure. Using CDN, origin content can be cached on nodes closer to users so content can load faster. CDN speeds up site response and improves site availability, breaking through the bottlenecks caused by low bandwidth, heavy user access traffic, and uneven distribution of edge nodes.

I choose the path of the OBS bucket in the first step when creating a Domain Name .

Huawei Cloud CDN
Add Domain Name at CDN
CNAME

In order for the domain name I created to be successfully , we must save the CNAME in DNS .

Add Record CNAME

HTTP headers are part of an HTTP request or response message that define the operating parameters of an HTTP transaction.

If you use an OBS bucket created after January 1, 2022 as the origin server and want to enable online preview, set Content-Disposition to inline. (see:https://support.huaweicloud.com/en-us/usermanual-cdn/cdn_01_0021.html)

HTTP Header Configuration

Domain Name enabled and working successfully at CDN .

Huawei Cloud CDN

Conclusion

Finally , www.testcloud.club works successfully .

Website

If you’re interested in getting hands-on experience with Huawei Cloud Services , you can register and explore KooLabs , Huawei’s online interactive and free learning platform , as well as Huawei Cloud Developer Forum , where you can connect with other developers and gain insights into Huawei’s Cloud computing solutions.

You can reach me from my Linkedin account for all your questions and requests.

Hope to see you in my next article…

References

1- Huawei Cloud Help Center

2- Huawei Cloud Developer Forum

--

--