CloudFront Turn on Compression
AWS Resource Type:
AWS CloudFront can automatically compress text-based data between 1KB and 10MB, resulting in reduced data egress costs. The compression will only occur if the client states it can handle compressed data, and if the source data is uncompressed.
Criteria for identifying the opportunity:
We only want to enable compression when it is safe to do so.
CloudFix will NOT enable compression if
- The cache policy is Managed (“CachingDisabled”)
We will enable CloudFront compression if
- There are no caching and compression policies
- The existing cache policies allow compressed files
Potential savings (range in % on annual basis):
The cost savings depend on the data and content your distributions are serving, and if the cache policies are compatible with compression. Based on our own experience, you can save up to 65% on your egress costs.
Also, serving already compressed files is faster. This is clear from the information available in the below external links. Note that the below links are quite old (when the internet was significantly lower). The improved performance comes from the fact that the file is compressed only once and cached - there is no need to compress on every request which adds latency.
As per CloudFix team's internal analysis, first-access times will be faster on connections slower than 315 Mbs/sec. As the line speed increases so the compression time has a larger effect. For a 10 MB file, the upper bound is 200 ms slower, and a 1 Gbs/sec line is 137 ms slower.
What happens when the Fixer is executed?
The fixer will enable compression for all CloudFront distributions matching the fixer criteria.
This fixer excludes any cases where compression might conflict with existing caching policies. In all other cases, enabling compression is risk-free: CloudFront only compresses data, if the client can handle compressed data i.e., when the client states it can decompress them, and when the source data is uncompressed.
Is it possible to rollback once CloudFix implements the fixer?
Manual rollback on your AWS account is possible. One-click rollback via CloudFix for this opportunity is currently not available.
Can CloudFix implement the fix automatically once I accept the recommendation?
Yes. OpenSearch domain storage resizing is automatic – once you accept the recommendation and schedule the fix, execution is automatic.
Does this fix require downtime?
No. It takes 15-20 minutes for the configuration changes to take effect, but CloudFront will serve the data using the previous configuration and seamlessly switch over to the new configuration.
Do it yourself (DIY) Instructions:
If you have CloudFix subscription, CloudFix will execute these automatic cost savings for you. However, if you'd like to do it yourself - please follow these instructions:
|Finding cost saving recommendations with CloudFix is FREE! You'll need a paid subscription only if you'd like CloudFix to execute those recommendations.|
- Open the AWS CloudFront console and select the distributions list
- For each distribution, click on the distribution ID
- Check the behavior details to determine if there is no cache policy. If a policy is selected, make sure it matches the fixer criteria
Select the behavior entry and click Edit
Set Compress objects automatically to Yes
- Save changes
- Allow for some time for the changes to take effect, normally 15-20 minutes.