By using AWS re:Post, you agree to the Terms of Use

Host S3 website with on-premises DNS server without Route53

0

I have an S3 bucket set up for "Static Website Hosting", a CloudFront distribution with our own SSL certificate and allowing Host header, a Global Accelerator IP address attached to an Application Load Balancer.

The Application Load Balancer does a 301 redirect to the S3 bucket. I know that you can set an EC2 instance as a target group and forward to that to preserve the original URL.

Can you also preserve the original URL using this method of 301 redirect to a Cloudfront distribution tied to an S3 bucket?

1 Answer
1
Accepted Answer

I'm a little unclear about what you're trying to do here.

If I follow correctly: Browser navigates to firstexample.com (hosted on ALB/EC2) which then redirects to secondexample.com (hosted on CloudFront/S3). You're looking for a way such that the browser doesn't see secondexample.com once redirected but firstexample.com instead?

By setting up (say) static.firstexample.com on CloudFront you can then pull static content from any S3 bucket you like. Then the redirect would be to static.firstexample.com. But you can't have the same hostname firstexample.com used for both CloudFront and ALB - well, not without randomly sending browser to either location.

However, the subject of your question mentions Route 53. In this case, if you're hosting content on firstexample.com you do need Route 53 in order to assign the "apex record" to a specific endpoint (ALB, CloudFront, whatever). If you were redirecting from www.firstexample.com to www.secondexample.com or static.firstexample.com then an on-premises DNS will work fine. Naturally, my next question would be "why not use Route 53 given it is a fully managed and highly available service".

profile picture
EXPERT
answered 6 months ago
  • I wanted to keep the original domain entered into the browser while serving up content from the S3 bucket. We did not want to use Route53 as that would require us to dedicate a portion of our IP address space to Route53 and that may change in the future. The question was incomplete and should have provided more detail. You were right in guessing what I was actually trying to do. In this case, I think we should use ALB/EC2 forwarding to an EC2 managed by Elastic Beanstalk.

  • I'm not sure why using Route 53 means dedicating a portion of your IP address space to Route 53. The only restriction here is that apex records are assigned to Route 53 Alias records which necessitates those resource being in AWS. But that has nothing to do with IP addressing.

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