Why is my static website that I host on Amazon S3 and serve through CloudFront down?

3 minute read
0

I use Amazon Simple Storage Service (Amazon S3) to host a static website and Amazon CloudFront to serve the website. The website is down, and I want to determine the cause.

Resolution

Before you begin, confirm that you have internet access. Also, confirm that the origin domain name that's specified on your CloudFront distribution points to the correct S3 bucket with no typos or other errors.

If you have internet access and the origin domain name is correct, then use the following troubleshooting steps to resolve your issue.

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

403 Access Denied error

You receive a 403 Access Denied error when there's a permissions issue that caused your website to appear down. To troubleshoot the issue, see Why do I get a "403 access denied" error when I use an Amazon S3 website endpoint as the origin of my CloudFront distribution?

Important: Be sure to check the Block Public Access settings for your website's S3 bucket. The settings can block anonymous requests to your website. Block Public Access settings can apply to AWS accounts or individual buckets.

404 Not Found error

You receive a 404 Not Found error when the request points to a website object that doesn't exist.

To resolve this issue, verify the following settings in your configuration:

  • The requested URL to the website object doesn't contain typos or unnecessary characters.
  • The website object exists on the S3 bucket that's hosting your website. You can use the Amazon S3 console or the list-objects-v2 AWS CLI command to check the bucket.

Internal error

When there's an Internal error in the response, then an internal service issue might be affecting your website. Check the AWS Health Dashboard for service disruptions and open events.

Note: Most AWS services are Regional, so be sure to search by the AWS Region that your resource is located in.

Website content corruption or delivery issues

When CloudFront doesn't correctly render or deliver your website content, you might receive corrupted JavaScript or missing CSS files.

To resolve this issue, take the following actions:

  • Correctly upload website resources, and make sure that the URL paths in the website's HTML are correct.

  • For mixed content errors, use HTTPS instead of HTTP to load all JavaScript and CSS resource files.

  • It's a best practice to use response header policies and cache content based on request headers.

  • If your updated website content doesn't display, then run the following create-invalidation command to create a new invalidation:

    aws cloudfront create-invalidation --distribution-id EDFDVBD6EXAMPLE --paths "/example-path/index.html"

    Note: Replace EDFDVBD6EXAMPLE with the ID of your CloudFront distribution. For more information, see How do I remove a cached file from CloudFront?

Related Information

Web Distribution Diagnostic

Troubleshooting error response status codes in CloudFront

AWS OFFICIAL
AWS OFFICIALUpdated a month ago