3
votes

I have a static website hosted in S3 inside the bucket client1.examplecorp.com with a corresponding R53 record client1.examplecorp.com. A ALIAS s3-website-us-east-1.amazonaws.com.

I want my client's (client1.com) webadmin to create a dns record for the subdomain quotes.client1.com which will point to AWS (The client1.com does not use R53).

Should it point to client1.examplecorp.com ?

Or directly at the S3 bucket endpoint ?

The concept is that, the final user will see only the quotes.client1.com subdomain and not know about client1.examplecorp.com .

I hope I describe it well enough...

I have read the AWS docs about Setting Up a Static Website Using a Custom Domain , Virtual Hosting of Buckets and also this SO post.

I have a feeling that what I am searching for is described here How to redirect domains using Amazon Web Services .

I just do not understand how the registrar of the client will redirect traffic for that specific subdomain (quotes.client1.com) to client1.examplecorp.com by adding the 4 nameservers.

Moreover, will the redirect affect only this subdomain or the whole client1.com .

Finally, will it be completely transparent? Meaning that, the client1.examplecorp.com will not be shown to the end user?

I have not a firm grasp on explaining it , so please bear with me.

2
Please rewrite (edit) this with the standard domains reserved for documentation, example.com, example.net, and example.org. It's not appropriate to use other people's domain names as examples. Note also that you appear to have used "corporation" and "enterprise" interchangeably, switching halfway through the question.Michael - sqlbot
I edited it and corrected it appropriately. I thought I used really generic domain names but I stand corrected after a little googling. No harm intended!Kostas Demiris

2 Answers

8
votes

Here are two possible solutions:

In these examples, the client's main domain is example.com.

Option 1:

Create a bucket whose name is the same as the desired hostname, and have the client create a CNAME record pointing to the web site endpoint for the bucket.

Bucket name:

quotes.example.com

Web site endpoint (assuming us-east-1 region):

quotes.example.com.s3-website-us-east-1.amazonaws.com.

Client DNS:

quotes.example.com. CNAME quotes.example.com.s3-website-us-east-1.example.com.

The client does not need to be using Route 53 for their DNS, but the bucket name must exactly match the hostname they are pointing to the bucket, because that is how S3 works.

Option 2:

Send the traffic through CloudFront. In this scenario, the bucket name does not matter, because CloudFront will translate it to the correct bucket name.

Bucket name:

example-bucket

Web site endpoint:

example-bucket.s3-website-us-east-1.amazonaws.com

New CloudFront Distribution system-assigned hostname:

djozxyqkexample.cloudfront.net

CloudFront Origin (do not select the bucket name from the dropdown list, type in the S3 website hostname as shown in the S3 console):

example-bucket.s3-website-us-east-1.amazonaws.com

CloudFront alternate domain name:

quotes.example.com

Client creates a DNS CNAME

quotes.example.com. CNAME djozxyqkexample.cloudfront.net.

This solution also does not require that the client use Route 53, and -- importantly -- the bucket name does not need to match the hostname -- the hostname simply needs to be configured as a CloudFront alternate domain name so that CloudFront recognizes the Host: header when it arrives.

If you want to reuse the same bucket for multiple sites, you can add more hostnames to the CloudFront alternate domain name setting, or you can create multiple distributions pointing to the same bucket.

Note also that using CloudFront in front of S3 is effectively free, because S3 will no longer bill you for bandwidth when you use CloudFront -- instead, CloudFront will bill you for bandwidth, at the CloudFront rate, which is often slightly lower that the S3 rate.


In both cases, above, the client does not need to use Route 53, because they hostname in question is not the zone apex hostname (the "naked domain"). To use a naked domain with either solution requires Route 53, but that isn't applicable here.

0
votes

Unfortunately, I think this is not possible. I am assuming that you own the corporation domain in this case.

For you to use client1.corporation.com, you had to use Route 53, right? You also could not configure some DNS record in your other NameServer and do the same.

Similarly, for you to use quotes.client1.com point to the S3 bucket, you also need to ask the client use Route 53.

Hope that helped Cheers!