Amazon CloudFront appears as one of the most popular content delivery networks. It allows you to store your site data as well as distributing your content all over the world.
If you’ve never used Amazon CloudFront and want to test how it works, you can try its free tier pricing. It gives you permission to use up to 50GB of data and 2 million HTTP/HTTPS requests each month.
There are 2 other pricing packages, including the on-demand pricing and the AWS discounted pricing. The former lets you pay for your CloudFront usage while the latter gives you a discount if you commit to using at least 10 TB monthly during one year. You can refer to this article about 6 Major Factors Impacting CloudFront Cost for more information on Amazon CloudFront pricing.
In fact, when your site grows, you definitely have to use more Amazon CloudFront storage. Then, your bill will go up, as a result. That’s why in this article, we gather some tips to help you save money with Amazon CloudFront.
Let’s get started!
#1 Take the Right CloudFront Price Package
You use Amazon CloudFront to deliver web and media content to clients across the world via S3 bucket or EC2 for instance. However, this doesn’t mean that you have to use all PoPs (Point of Presence) available. If your users mostly come from the EU and US, just use edge locations in Europe and Israel, the USA, Mexico, and Canada.
On top of that, if you’re an SMB (small and medium business), Amazon CloudFront’s on-demanding pricing plan fits you the best. Since the first 5GB is totally free, you then just need to pay for the storage you want to use after that.
Although the Discounted pricing offers some discounted percentages, consider this only when you have a lot of data to deliver with a huge amount of traffic every day. In case your site traffic fluctuates and you can’t predict its trend, we recommend the on-demanding pricing.
#2 Use Cache-control
Cache-control allows you to use the browser cache of your users more to reduce the Amazon CloudFront costs. By saving a cached version in the user browser, you can reduce the load to your server. This way helps cut Amazon CloudFront costs for transferring data.
It’s possible for you to decide how long your files can be stored in edge locations and the user browser. By increasing this duration, you can serve users without having to keep requesting the origin server to send data every time a visitor coming to your site.
Follow this guide to use the cache-control:
- Sign in and log into AWS Management Console
- Go to Services → Amazon S3 and pick the files you want to increase the expiration time
- Find the name and open your desired object
- Head to the Metadata section and click Edit
- Hit the Add Metadata button
- Select Cache-Control or Expires in the Key menu
- Enter one of the 2 options below:
Cache-Control field: max-age=number of seconds. This means that your object will be kept in a CloudFront edge cache
Expires field: date and time in HTML format
- Invalidate these metadata in CloudFront distribution settings
#3 Use CloudFront CDN
If you’re using AWS, you should also use CloudFront as your CDN distribution. When you use CDN of another service, you have to pay money twice for 2 different places. Since AWS and CloudFront come from the same provider, you don’t have to pay extra for data transfer out of Amazon services such as S3, EC2, and ELB.
#4 Compression to Reduce Amazon CloudFront Cost
CloudFront can help compress some of your files automatically. As a result, it cuts the amounts of data delivered to clients which reduces the cost. You can also speed up the load time for clients.
Optimize Your CloudFront Cost Now!
It’s common to use Amazon CloudFront to deliver files and content to clients across the world quickly. However, not all users know to make use of it and at the same time save money.
We’ve shown you 4 ways to reduce CloudFront costs. You firstly should pick the right pricing plan for your business. You can use the cache-control to serve users the cached version instead of sending request to the origin server.
It’s recommended to use CloudFront CDN if you’re using AWS too. You should configure CloudFront to let it compress files automatically so that it just needs to deliver files at the smallest data amount.
Still have questions about how to reduce CloutFront cost? Let’s discuss this in the comment section below.