I am trying to setup CloudFront
to serve static files hosted in my S3
bucket. I have setup distribution but I get AccessDenied
when trying
This can happen if you are using a bucket that has just been newly created.
According official reply here: AWS Forun link, you have to wait for a couple of hours after creating a new bucket before you can have cloud front distribution working on it correctly.
Solution is to temporarily work from one of your old buckets and switch to the new bucket a couple of hours later.