DEV Community

Discussion on: Host Static website using AWS CDK for Terraform and CloudFront: Part 2

Collapse
 
shotlom profile image
Sholto Maud

I get access denied on my url - how did you make sure your Cloudfront can have access to the S3? Also, do you Route53 for your dns?

Thread Thread
 
thakkaryash94 profile image
Yash Thakkar

We have setup CloudFront Origin Access Identity(OAI) and also updated the S3 bucket permission as below.
{
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${cloudfrontOriginAccessIdentity.id}"
}

So with this, only CloudFront will be able to access the bucket using OAI.