Improve Website Loading Speed with Free CDN Provided by Amazon Web Services

Publish: 2023-12-28 | Modify: 2023-12-28

Amazon Web Services (AWS) provides a free package that includes Amazon CloudFront. Amazon CloudFront is a fast content delivery network (CDN) service designed to securely and efficiently distribute data, videos, applications, and APIs to users worldwide using AWS's global edge node network. By caching content and optimizing transmission, it significantly improves the loading speed of websites and applications, while providing data encryption and network protection to ensure secure content delivery.

54b1e43c7322bb83.png

Amazon CloudFront Free Package includes

As part of the free usage package provided by AWS, you can start using Amazon CloudFront for free. The free package includes the following:

  • 1TB of data transfer to the internet per month
  • 10,000,000 HTTP or HTTPS requests per month
  • 2 million CloudFront function invocations per month
  • 2 million CloudFront KeyValueStore reads per month
  • Free SSL certificate
  • No limits, all features are available

This free tier is sufficient for most websites.

Reference: Amazon CloudFront Pricing

Register for an AWS Account

Before using Amazon CloudFront, you need to register for an AWS account. You will need:

  • A valid email address
  • A valid phone number
  • VISA/MasterCard credit card

Click on the link: AWS to register. When registering, make sure to select "AWS China (Ningxia) Region" if you are in China.

9488c3363d1ca794.png

Enter your email address and account name.

c9edc2cd83a2ea78.png

Enter the verification code sent by AWS to your email for verification.

cf59c3ea4eb77411.png

Set your account password.

3e47634f1c8cdace.png

Next, provide your contact information. Please note:

  1. Select "Personal" or "Business" user based on your situation. The example here is for a personal account.
  2. Provide accurate information for full name, phone number, address, etc. Do not provide false information, as it may trigger security measures.

9b5cc1f6d8c1349a.png

Next, you will need to verify your phone number.

5e91003286ee8c5f.png

Finally, choose a support plan. Select "Basic Support - Free" for the example here.

15b76f71725b11d3.png

After completing the registration process, wait for your account to be verified before you can start using the free package provided by AWS.

Using Amazon CloudFront Free CDN

Go to Amazon CloudFront and add the domain name of the website you want to accelerate. If you have both HTTP and HTTPS access, you can choose to match both. If you choose HTTPS, make sure your certificate is valid.

c2c744b02d359eb6.png

Next, select the protocol type and HTTP settings. The first option is for accessing settings for the viewer. The Viewer protocol policy determines whether to redirect HTTP to HTTPS based on your external access needs. The Allowed HTTP methods are the allowed request methods. Choose the appropriate option based on your needs. In general, the first option is suitable for file download scenarios, the second option is suitable for static websites, and the third option is necessary for dynamic websites. If you are unsure, choose the third option to support all methods.

9d6204ca5dfb03bf.png

For CDN optimization strategies, the default options are sufficient.

b3b42742aee0597a.png

Keep the other settings as default and click "Create".

3d29c6e9c12a7abb.png

8db00088a3b48afe.png

After successful creation of CloudFront, you will see the generated subdomain for CloudFront. This is the CDN management center for CloudFront.

564e6f5acf05e213.png

Click "Edit" to adjust the settings for your CloudFront CDN.

ca4f39cfc8b83511.png

Open the CloudFront domain to see the static files such as images for your website.

cc0eada2456b3d33.png

Amazon CloudFront provides free SSL certificates. If you want to use your own domain with Amazon CloudFront, you need to request a free SSL certificate from Amazon CloudFront.

2259a302203a2d45.png

Click "Request a certificate" and follow the steps. Choose DNS validation.

3e5dd8973cba1642.png

Amazon CloudFront will provide a CNAME record for domain ownership verification.

7b51fd0369874b74.png

Modify the CNAME record in your DNS settings. Once the domain ownership is verified, your SSL certificate will be issued.

5213eeca44c53be9.png

By default, CloudFront CDN caches the entire site. If you want to set cache for specific URL paths, you can do so in the CDN settings.

a7fde5ab9c1058a5.png

The cache or exclusion depends on the Path pattern (case sensitive). You can use wildcards * and ?? for matching. For example:

Path pattern Matches

  • /files/* All files under the /files/ path
  • /*.jpg All files with the .jpg extension in the CDN resources
  • /.css All files with the .css extension and with parameters in the access
  • /files/*.gif All files with the .gif extension under the /files/ path
  • /a??.mp3 All mp3 files starting with "a"

Amazon CloudFront allows you to restrict access by geographic region.

ed47901f7c4e575f.png

CloudFront CDN provides Asia Pacific nodes. The following image shows the access to a node after using CloudFront CDN, which has good performance.

7d790c8cc71d39c1.png

CloudFront CDN Costs

Although Amazon CloudFront is free, it has certain free limits. Be aware of whether you exceed the free limits, as the additional costs can be expensive.

e36d1288e614850e.png

Please pay attention to the cost of site request traffic. The free tier provided by AWS may not cover all normal usage. Additionally, using EC2 as the origin server will also incur costs. The bill is generated once a day, so remember to monitor your expenses.

Conclusion

As a leading cloud service provider, AWS provides a free usage package for CloudFront CDN, which is usually sufficient for small blogs. However, users need to be aware that once they exceed the free limits, additional costs will be incurred.


Comments