Home > database >  Route traffic to S3 hosted static website
Route traffic to S3 hosted static website

Time:03-01

Have two aws account.

Account-1 is having hosted zone abc.io

Account-2 contains the S3 bucket with static website.

How to create record set in Route53 in Account-1 so that my.abc.io routes the traffic s3 hosted website on another aws account.

CodePudding user response:

You can create a DNS CNAME record in Route53 in your Account-1 for my.abc.io to a value of BucketName.s3.Region.amazonaws.com. where BucketName is your bucket name and Region is the region of the bucket.

This will let any caller redirecting DNS queries against your Route53 hosted zone towards Amazon's S3 DNS records, so this solution works on a DNS-level (not e.g. on HTTP redirect level).

Please note that a CNAME DNS record is just a textual value, that you can point to any domain name (even www.google.com). The value of a CNAME record does not need to be related to anything in your Account-1 or even anything related to an AWS resource anywhere. Using a DNS CNAME record is just a way to tell a DNS requestor "hey, when you requested an A record for my.abc.io what you actually should be doing is requesting an A record for BucketName.s3.Region.amazonaws.com."

And AWS S3 buckets have a canonical naming scheme for their domain names.

See for further information:

CodePudding user response:

You can create the HZ my.abc.io in the account with the website and create a NS record in the account with the top domain to it and set the values to the same as the NS record in the HZ in the account with the website. After this you create all the records needed to route the traffic to your site in the account with the site. This design I think keep the accounts HZ cleaner and easier to read/follow.

I have been using this design and really need to do so due to that we not only have one account that we have connected to the "top domain account".

  • Related