CloudFront pricing is dependent on the region where you want the content to be served, the data transfer out to Internet costs (where data is transferred from CloudFront to the Internet), data transfer out to origin (where data is transferred from CloudFront to the origin server) and number of HTTPS requests. Beyond this, one can opt in for additional features like Origin shield request, edge compute, field level encryption among other things.
It is important to minimize requests to the origin server to reduce data transfer costs. When a user requests a file that is not cached in a CloudFront edge location, CloudFront has to retrieve the data from the original server. This is a cache miss and reducing such cache misses will help bring down data transfer costs. Use appropriate CloudFront cache settings to serve files from edge locations that are closer to users to contain data transfer costs.
Distributions are billed per GB of data transfer from the distribution back to the origin. The prices are available at a flat rate and depend on their geographic area. Source: AWS
Analyze your usage patterns to identify edge locations that are not contributing significantly to your traffic. Consider parameters such as geographical locations of your users, performance requirements, and your budget for the analysis. Evaluate the impact of disabling an edge location on the user experience. Finally, remove unnecessary edge locations to reduce CloudFront costs.
Price Class in Amazon CloudFront billing provides a way to balance out between latency and costs by selecting the appropriate edge locations through which content can be delivered. In essence, price classes are a group of edge locations clubbed together to offer varied latency and costs options to users. AWS offers three Price Classes for CloudFront i.e. ‘Price Class All’, ‘Price Class 200’ and ‘Price Class 100’. Price Class All is enabled by default wherein AWS will select all the edge locations available in the selected region to deliver your content. Selecting this price class would mean increased costs for users while ensuring the least latency possible. However, if latency isn’t a concern, then one may opt for Price Class 200 or Price Class 100 as alternatives, the latter being the most economically viable option.
File compression helps CloudFront costs in two ways:
Image and text files can be compressed significantly to achieve a notable reduction in costs.
AWS offers a Savings Bundle plan which can offer up to 30% savings in exchange for a monthly spending commitment for a one-year term. It is equivalent to purchasing savings plan for other services on AWS, but only applicable to CloudFront. Besides this, AWS also offers discounted pricing to consumers committing at least 10 TB of data transfer per month for a period of 12 months or more. Depending upon the workload, enterprises can choose to opt for either of these cost savings options.
Amazon CloudFront caches content in edge locations to increase high availability of your data. While this is good for latency and user experience, it is important to keep an eye on the overall costs. By analyzing usage patterns, evaluating pricing classes available, compressing data files before transfer, and optimizing the usage of edge locations, it is possible to contain CloudFront costs while providing a superior experience to users.
Strategical use of SCPs saves more cloud cost than one can imagine. Astuto does that for you!