简体   繁体   中英

AWS Route53 Sub-Domain Redirection Design

AWS Design Question.

We have 'n' number of static React JS website to host. Since we have more than 100 website at the moment ( it will keep growing ) , we planned to host the website in s3 bucket.

we cannot create s3 bucket for each new website and create an cloud front for each bucket.

so we decided to put all the websites in a single bucket with each website in a individual folder, and mount the s3 bucket in a ec2 linux instance apache folder ie /var/www and make necessary configuration (including SSL) .

so presently, we have a domain(self-managed) eg ' sample.net ' -> pointing to the ec2 instance apache server .

To access a website called ' sample-website ' -> www.sample.net/sample-website apache will server me the website from the bucket which has the folder called sample-website.

Presently we have a another domain called ' sample.com ' in Route53, we would like to create sub-domain (CNAME record) in run-time and set the value to www.sample.net/sample-website .

I have written code in python using boto3 to create CNAME record in runtime.

Two Questions based on the design:

1 - Can we have SSL for ' sample.com '? as we have SSL certificate for ' sample.net '

2 - Is there a better way to do it?

Design Image: 在此处输入图片说明

PS:

create sub-domain (CNAME record) in run-time and set the value to www.sample.net/sample-website

Sadly, you can't do this . Route53 is a DNS resolver, and it does not have any notion of URL paths, such as /sample-website . You could possibly do it from CloudFront or your load balancers, where you can specify the URL paths.

Can we have SSL for 'sample.com'? as we have SSL certificate for 'sample.net'

Yes you can. Using AWS ACM you can register a single SSL cert for multiple domains.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM