When creating a [[AWS CloudFront|CloudFront]] distribution, you can set a [PriceClass](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-priceclass) to one of 3 values: `PriceClass_ALL` (default), `PriceClass_100` or`PriceClass_200`.
This decision boils down to a trade-off between 2 factors:
1. **the latency experienced by end users** in certain geographic locations accessing content from the distribution; and:
2. **the increased cost** that AWS charges to serve content from locations in these geographic locations
If your app has users in one of the more expensive geographic locations, you need to decide if the increased cost of serving content from an edge location closest to them is worth the extra cost.
AWS has grouped different regions in these 3 price classes as follows: [^aws1]
[^aws1]: https://aws.amazon.com/cloudfront/pricing/
![[CloudFrontPriceClasses.png]]
However, a complicating factor is that there are 2 key dimensions of pricing that will generally come into play as variables between regions:
- Regional Data Transfer Out to Internet
- Number of Requests
It seems that AWS has only used *Number of Requests* as the factor to determine how to classify into each bucket. For example, South America is one of 2 regions that is only available in the `PriceClass_ALL` class. It is, as you would expect, the most expensive using the *Number of Requests* dimension, costing 2.2x that of the least expensive region (United States, Mexico, & Canada).
However, going on the *Regional Data Transfer Out to Internet* dimension, India is the most expensive, costing 2x that of the least expensive region for the First 10TB (United States, Mexico, & Canada). However, India is included in `PriceClass_200`. 🤨 Given that the *Regional Data Transfer Out to Internet* dimension will probably make up most of the total cost for most apps, this seems a strange way to classify.
## Decision criteria
The simplest solution without doing any calculations is to look at the Price Class regions table from above and select the price class that includes all the regions where you expect a significant amount of users from. The worst case is that you get a load of users downloading content from a more expensive region and your bill may be up to 2.2x higher.
If you wish to be a bit more rigorous, follow these steps:
1. If you only need to serve users in `PriceClass_100` regions (or don't care if it's slow for users outside of these regions), just choose that.
2. If you need to serve users in `PriceClass_200` or `PriceClass_ALL` regions, check the most expensive regions in the class (e.g. India for `PriceClass_200`) and use the [[Serverless Cost Calculator (tool)]] to see if the costs would be worthwhile based on the amount of users you (make sure to update the pricing constants for your region in the spreadsheet)
---
## References
From [the docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html):
> CloudFront edge locations are grouped into geographic regions, and we've grouped regions into price classes. The default price class includes all regions . Another price class includes most regions (the United States; Canada; Europe; Hong Kong, Philippines, South Korea, Taiwan, and Singapore; Japan; India; South Africa; and Middle East regions) but excludes the most expensive regions. A third price class includes only the least expensive regions (the United States, Canada, and Europe regions).
Also from the [CloudFront Pricing Page](https://aws.amazon.com/cloudfront/pricing/):
> Price classes provide you an option to lower the prices you pay to deliver content out of Amazon CloudFront. By default, Amazon CloudFront minimizes end user latency by delivering content from its entire global network of edge locations. However, because we charge more where our costs are higher, this means that you pay more to deliver your content with low latency to end-users in some locations. Price Classes let you reduce your delivery prices by excluding Amazon CloudFront’s more expensive edge locations from your Amazon CloudFront distribution.