- Newest
- Most votes
- Most comments
Given the JavaScript error message you're getting your script.js is calling something or your index.html is including something else.
Try going simple first - host a "Hello World" HTML page and see if that works and then add complexity from there.
Also, given that there is a 403 error here perhaps there is some other configuration in CloudFront?
hi, thank you for pointing out for CF configuration error! as I mentioned in my original question i did not used signed request, that was the problem as this new OAC advanced method does not rely on OAIs (used use the OAI ID in bucket policy) new OAC ruse SigV4 enhanced security. It resolved- steps, in CF distribution -origin tab-Origin access-Origin access-control created new OAC with signed (recommended) again copy S3 bucket permission and updated in s3 bucket. and it works. :-).
Based on the information provided, there are several potential reasons for the Access Denied error you're encountering with your CloudFront distribution and S3 bucket setup. Here are some key points to check and potential solutions:
-
S3 Bucket Policy: Ensure that the bucket policy you've applied matches exactly what CloudFront provided when setting up the Origin Access Control (OAC). The policy should allow the CloudFront service principal (cloudfront.amazonaws.com) to perform the s3:GetObject action on your bucket's resources. Also, verify that the AWS account ID and distribution ID in the SourceArn condition are accurate.
-
Origin Access Control (OAC) Configuration: Double-check that the OAC is correctly set up and associated with your CloudFront distribution. The OAC should be configured to use the S3 REST API endpoint, which you've correctly specified as maliniresume.s3.us-west-1.amazonaws.com.
-
CloudFront Distribution Settings: Verify that your distribution's origin settings are correctly pointing to the S3 REST API endpoint and that the OAC is properly linked.
-
S3 Bucket Permissions: While you've mentioned that public access to the S3 bucket is blocked (which is correct), ensure that the bucket's ACL settings allow the bucket owner full control.
-
Object Permissions: Check that the objects within your S3 bucket have the correct permissions for CloudFront to access them.
-
CloudFront Cache: Although you've mentioned invalidating the cache, sometimes it can take a short while for changes to propagate. Wait a bit and try again.
-
S3 Bucket Encryption: If your bucket uses SSE-KMS encryption, make sure the KMS key policy allows CloudFront to decrypt the objects.
-
CloudFront Function or Lambda@Edge: If you're using any CloudFront Functions or Lambda@Edge to modify requests, ensure they're not interfering with the request to S3.
-
CloudFront Distribution Status: Verify that your CloudFront distribution status is "Deployed" and not still in progress.
-
Error Logs: Check both CloudFront and S3 logs for more detailed error information that might point to the specific issue.
If you've verified all these points and are still encountering the Access Denied error, you may need to engage AWS Support for further assistance. They can provide more in-depth troubleshooting based on your specific account and resource configurations.
Sources
Troubleshoot 403 Access Denied error in Amazon S3 | AWS re:Post
Troubleshooting distribution issues - Amazon CloudFront
Request for Help: Access Denied Error with CloudFront and S3 Bucket Policy | AWS re:Post
HTTP 403 status code (Permission Denied) - Amazon CloudFront
- yes! copy past from CF policy generated. 2. it is REST endpoint, it was mentioned. 3. yes! it was mentioned also. 4. and 5. yes! 6. yes! 7. Default encryption 8. not using . 9. it is enable 10. no alarm don't turn on CF log.
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 5 months ago

Can you pls supply your bucket policy?
{ "Version": "2008-10-17", "Id": "PolicyForCloudFrontPrivateContent", "Statement": [ { "Sid": "AllowCloudFrontServicePrincipal", "Effect": "Allow", "Principal": { "Service": "cloudfront.amazonaws.com" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::maliniresume/*", "Condition": { "StringEquals": { "AWS:SourceArn": "arn:aws:cloudfront::<account id>:distribution/EO9YJD19H7YWS" } } } ] }