Configuring static website with S3 bucket, Route 53 (and SSL certificate) does not work

0

Hello!

I have created a static website and basically followed and configured all instructions linked in this article. However, when I try to open the custom domains, I receive following errors:

  1. for recruiteroo.de: 404 not found / nginx
  2. For www.recruiteroo.de: DNS_PROBE_FINISHED_NXDOMAIN / The website is not reachable

I can't find any setting that would diverge from what has been suggested in the article.

Does someone have any idea on what could go wrong?

Side note: I transferred the above domains from another domain provider to Route53 successfully, if that is of relevance.

I did, too, configure a SSL certificate through AWS Certificate Manager, but don't think that this would have an effect.

asked 8 months ago401 views
2 Answers
3
Accepted Answer

Hi Recruiteroo,

The error messages you provided indicate both a DNS and a possible web server configuration issue.

Lets check some items:

  • Make sure the bucket has been set up for static website hosting and note the provided endpoint.
  • Ensure you have an index document (e.g., index.html) in the bucket.
  • For recruiteroo.de, ensure there's an A record in Route 53 with Alias set to the S3 website endpoint.
  • The "404 not found / nginx" error indicates there might be a lingering server configuration associated with the domain or there's a misconfiguration at the DNS or CDN level.
  • If you previously had a web server (like nginx) associated with this domain, ensure you've updated all DNS records to point to AWS services (S3/CloudFront) instead of the old server.
  • Use tools like nslookup or dig to check DNS resolution for your domains.

When setting up a static website on S3, the bucket's content needs to be publicly accessible so that users can view the site. However, there are a few different approaches:

  • Bucket Policy for Public Access: Traditionally, a bucket policy was set to grant public read access. This is effective and allows anyone to view the bucket's content.
  • Using Amazon CloudFront (recommendation): For added performance and security, you can distribute your S3-hosted website with Amazon CloudFront. By using CloudFront, you benefit from faster content delivery via a Content Delivery Network (CDN), as well as the ability to use an SSL/TLS certificate for your custom domain.

I hope this helps! If this solution works for you, please accept the answer. Otherwise, do leave a comment, and I'll try to assist you.

profile picture
answered 8 months ago
profile picture
EXPERT
reviewed 24 days ago
profile pictureAWS
EXPERT
reviewed 8 months ago
  • Thank you for the hints and quick reaction! In fact, it was an old AAAA record that pointed to the former hosting provider. I deleted the record, and it worked!

    Question: How would I be able to create a new AAAA record, where would I get the value for the IPv6 address from?

1

If you want to also use an SSL Certificate, you should rather serve your static website with CloudFront. In this case you can use any S3 bucket as the origin, and configure an origin access identity in CloudFront to connect to S3.

There is a pretty comprehensive answer here by AWS Support on the details of using this approach: https://repost.aws/knowledge-center/cloudfront-serve-static-website

AWS
EXPERT
answered 8 months ago
profile picture
EXPERT
reviewed 2 months ago
  • Thank you for the hint with CloudFront and the link - this will definitely be the next step, while the solution to the initial problem was provided by another user.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions