☁️ Accelerating ECS Resources with Huawei Cloud CDN
Introduction
Hi everyone, In this article, we will explore how to accelerate ECS resources with CDN.
Huawei Cloud CDN can effectively accelerate websites to deliver a better user experience. If you use CDN to accelerate ECS resources, you can improve the user experience at low costs. When a user initiates an access request, CDN checks whether the content requested by the user is cached on the CDN node with the fastest response speed. If the CDN node has cached the content, the CDN node directly returns the content to the user. If the CDN node does not cache the content, the CDN node retrieves the content from the origin server, returns the content to the user, and caches the content.
Services Used
- Elastic Cloud Server (ECS)
- Content Delivery Network (CDN)
- Domain Name Service (DNS)
Service Details
1. Creating ECS
Begin by setting up an Elastic Cloud Server (ECS). Install Nginx on the ECS, create a one-page website, and upload it to the ECS. This establishes the foundation for the ECS resources we’ll be accelerating.
2. Adding a Domain Name on CDN
Purchase a domain name (e.g., www.testcloud.club) from a domain registrar like GoDaddy. Add this domain name to the CDN service on Huawei Cloud.
Define the ECS server you created as the source server in the CDN service. This step ensures that the CDN service is aware of the origin of the content it needs to accelerate.
3. Creating a Public Zone on DNS
Once again, utilize the domain name purchased from GoDaddy to create a public zone on the DNS service. Add CNAME records from the CDN service to the DNS service. This connection allows the CDN service to fetch content from the ECS server.
4. CDN Cache-Control
Observe the functionality of the one-page website on the Nginx server without CDN cache control.
Then, enable CDN cache control and verify its successful operation. Note that specific configurations, such as adding a custom header like “huawei=mucahid” can be implemented to further optimize CDN functionality.
CDN cache control is working successfully.
5. Verifying CNAME Record
To ensure the effectiveness of the configuration, open the Windows command line interface and run the command:
nslookup -qt=cname Acceleration domain name
If the CDN-generated CNAME record is displayed, the configuration has taken effect, and the CDN works successfully.
Conclusion
The step-by-step implementation detailed in this article underscores the accessibility and practicality of this solution. Creating ECS instances, adding domain names to CDN, configuring DNS settings, and fine-tuning CDN cache controls become manageable tasks. By strategically employing CDN to accelerate content delivery, businesses not only improve user satisfaction but also achieve significant cost savings.
References
1- Huawei Cloud ECS
2- Huawei Cloud DNS
3- Huawei Cloud CDN