0

I have looked at documentation on how I can redirect my traffic from one domain to another in AWS but to no avail I am unable to. The way I see the process using AWS is like so:

Route 53 ----> S3 ----> CloudFront ----> ALB ---> CloudFront?

What I have done are the following:

  1. I modified the A record of monkey.com's CloudFront ID 444fasdfdd.cloudfront.net to point to the CloudFront ID 3dfdsafds3.cloudfront.net of ape.com.
  2. I modified the ALB used for monkey.com and created a Listener rule to redirect traffic of www.monkey.com and monkey.com to ape.com
  3. I went to monkey.com's S3 bucket which is using Static Web Hosting and redirected the bucket to go to ape.com.
  4. This is where I am stuck, I do not know what to do on monkey.com's CloudFront Distribution. I want to change the "Alternate Domain Name (CNAME)" of www.monkey.com and monkey.com to www.ape.com and ape.com and replace the Custom SSL certificate of *.monkey.com with *.ape.com; however, I receive an error saying I already have a Distribution of ape.com (which is true).

I hope I made myself clear on the issue I am having. If you want me to clear up any confusion please let me know.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Roma
  • 535
  • 6
  • 18
  • Why not redirect directly using R53? That's how usually it is done. – Marcin Feb 15 '22 at 03:23
  • I did do this Marcin. Should be step 1 where I went to the A record and changed the CloudFront ID to ape.com. The only possibility I am thinking is CloudFront's TLS cache. – Roma Feb 15 '22 at 03:28
  • @Roma if you have edited Route 53 record for monkey.com to CloudFront of ape.com, I think you are using ape.com as the backend, but the URL will still show as monkey.com. Is this what you intended? I have a feeling what you want is for people who visited monkey.com, they will be redirected to ape.com (URL will change to ape.com), is this correct? Because in this case, you still need monkey.com A record to point to a monkey.com website whose only purpose is return a redirection. – Register Sole Feb 15 '22 at 07:47

1 Answers1

0

If you edited Route 53 A record for monkey.com to the CloudFront of ape.com, you are using ape.com as the backend, but the URL in the viewer's browser will still show as monkey.com.

Instead, what you need to do is keep Route 53 monkey.com and point it to a dummy website whose only purpose is to return a redirection to the new domain. You can use S3 website for this, or any other web hosting for that matter. Example of using S3 for redirection.

Register Sole
  • 3,206
  • 1
  • 14
  • 22
  • Hmmm yes, I just want to redirect traffic over where the user will be redirected to the new improved site of `ape.com` which already exists in an S3 bucket. Let me try this and get back to you. Was overlooking this last night. – Roma Feb 15 '22 at 14:51
  • So an update. I am close to getting this to work. I followed the article and redirected the S3 bucket to the `ape.com`; however, when I try attaching the S3 bucket endpoint it is not registering. Mind you, the buckets are in two different accounts so I believe this is where I am running into a wall. – Roma Feb 15 '22 at 17:57
  • I got it to work by redirecting the bucket and changing the records to the CloudFront Distribution of `monkey.com`; however, when being redirected I am pointed to an index.html file such as `monkey.com/index.html` saying, "404 error". Also `www.monkey.com` is not directing of where it should go to. Going to look into this more. – Roma Feb 15 '22 at 19:49
  • 1
    Ok, got it to work! I had to go into my CloudFront Distribution and **remove** the `index.html` which was causing the `Error 404`. Thanks for the help @Register Sole – Roma Feb 15 '22 at 20:18