CloudFront will turn your fast site into a really fast site. We will taking a Spar app with an S3 Deployment and adding a content delivery network on top of it. From the AWS CloudFront Console, create a new distribution with the website form of your bucket name as the origin:
When the wizard closes, take note of the ID and Domain Name fields (something like
If you followed the S3 Deployment instructions, you have a CNAME pointing to your S3 bucket. Update that to point to your new CloudFront distribution's domain name instead.
app.example.com. IN CNAME d242ood0j0gl2v.cloudfront.net.
And update your
production: deploy_strategy: cloudfront aws_key: "my_access_key" aws_secret: "my+super+secret+access+key" deploy_bucket: "mysite.test.com" cloudfront_distribution: "distribution+id"
Now, every time you deploy, Spar will automatically issue CloudFront invalidation requests for index.html (and anything else without a hash value). CloudFront invalidations usually take around 8 minutes, but they can take quite a bit lot longer when Amazon is having problems.