Easy AWS cost saving trick with Cloudfront

Our static assets (JS/CSS/img) are all hosted in a S3 bucket, and served to browsers by Cloudflare CDN:

With Cloudflare offloading most of the bandwidth, the cost of serving static assets is actually kind of low, with just about 20GB of transfer-out data, but since Cloudfront do offer always free 1TB bandwidth:

And from EC2 to Cloudfront is always Free:

Why don't we make use of it to save the 20GB per month bandwidth?

And so we did:

  1. Create a new Cloudfront Distribution, setting Origin to our static asset bucket DNS name.

  2. change the CNAME at Cloudflare to the Cloudfront Distribution Domain

And that's it, free + easy to setup 20GB transfer-out bandwidth. The maximum saving could go up to 1TB x $0.12GB per month = $122.88.