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개 답변
1
수락된 답변

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 pictureAWS
전문가
답변함 2년 전
  • 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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠