Reputation: 287410
I'm moving my domain names from CloudFlare's DNS to AWS Route53 and in some cases I'm using CloudFlare's redirects for project that are dead so that their domains go to a page in another domain, so https://projectx.com
goes to https://example.com/projectx-is-no-more
.
I want to replicate this in AWS and what I found so far is this:
https://example.com/projectx-is-no-more
projectx.com
I set it up, it's working, I'm even using CDK so I'm not doing it manually. But I'm wondering if there's a way of setting up these redirects that requires less moving pieces. It sounds like such a redirect would be a common enough problem that maybe Route53 or CloudFront would have a shortcut. Are there any?
Update: using only S3 doesn't work because S3 cannot serve https://projectx.com
. S3 has no method by which it can respond to HTTPS request for arbitrary domains, there's no way of adding a TLS certificate (and keys) for another domain.
Upvotes: 1
Views: 206
Reputation: 9364
I checked for information and see only three possible solutions:
※ S3 support only HTTP traffic so we need to add CloudFront for HTTPS:
Amazon S3 does not support HTTPS access to the website. If you want to use HTTPS, you can use Amazon CloudFront to serve a static website hosted on Amazon S3.
In my opinion the ②nd way is super easy to set up but running 24/7 ALB is little bit expensive. In other way Lambda and API Gateway price depending on requests count. CloudFront seems to be cheaper than ALB too.
So the better solution is depending on how many requests you have
The ④th solution is depends on GitHub platform (wider than AWS only scope), but it is absolutely free and support custom domain and Let's Encrypt certificates out of the box.
You just need to create repository with static index.html
file that will do redirects
Upvotes: 1
Reputation: 3757
You can do it without including CloudFront.
What you need to do is create S3 bucket projectx.com
. In Properties
go to Static website hosting
. Enable static website hosting and choose Redirect
as a hosting type (add the redirection URL).
You will still need to set up Route53, but you will now add alias to this projectx.com
bucket, instead of going to CloudFront
Upvotes: 0