When migrating to CloudFront don’t introduce circular references. This should be obvious, but sometimes in the heat of battle, details get overlooked and everything comes crashing to the ground.
tl;dr: If CloudFront is going to front your
www.example.com domain, you cannot point your
distribution origin to
www.example.com. You might irrationally be tempted to do this because
you have an existing shared provider where things are already running well and successfully,
and you don’t want to be bothered using S3 instead.
If your public domain — specified in your DNS CNAME record — is
CloudFront is trying to pull from the origin
www.example.com, you will have problems.
You could solve this by using another domain on your shared host, e.g.,
but in most cPanel hosting environments this means setting up a new subdomain and assigning a
new root directory. And of course, anyone could still access your origin site using the
origin.example.com domain directly.
In the end, I simply put everything into S3 and used that as CloudFront's origin.