1
votes

I have a repository bucket on amazon. In this repository I have a page, with only css, js and html, I start the application with the index.html.

The application url is available, and look like this :

example.s3-aws-region.amazonaws.com. 

I want to redirect all subdomain of the url to the url application, for example if I go to the following url I want to redirect to the url of the app :

bucket.example.s3-aws-region.amazonaws.com
subdomain.example.s3-aws-region.amazonaws.com
subdomain_2.example.s3-aws-region.amazonaws.com

(Note that the domain is provided by amazon, not a personal domain)

So, I need to edit the dns and create a CNAME record. I tried creating a host zone, and then I created a CNAME record with the following value *.example.s3-aws-region.amazonaws.com

But it didn't work

How can I do it?

1
There are several problems with what you are trying to do, not the least of which is that you don't own the amazonaws.com domain... so, yes, you can create a hosted zone for that domain, but it will never work, because you have no authority (and cannot obtain the authority) to create records that will be visible to the Internet. What are you actually trying to accomplish, and why are you not using your own domain name?Michael - sqlbot

1 Answers

2
votes

You cannot do this using CNAME entries because you do not own the amazonaws.com domain.

Instead, you can use multiple buckets along with 301 redirects.

  1. Create your main bucket, let's assume it's called example.
  2. Create a second bucket called subdomain.example.
  3. On subdomain.example, configure "Static Website Hosting" to "Redirect all requests to another host name" using example.s3-website-region.amazonaws.com as the target.

Then, in your browser, if you go to subdomain.example.s3-website-region.amazonaws.com, you will be 301 redirected to example.s3-website-region.amazonaws.com.

Note that this is a 301 redirect, it's not a CNAME or an alias. So the redirect will be visible in the browser address bar.