AWS - redirecting domain to url using a 302 redirect (without running a server)I wanted to make a domain name (heckingoodboys.com) redirect to a multisubreddit for dog pictures, but I didn't want to run a web server for it.
Here's what I did:
- Purchase the domain using Route53.
- Create two public s3 buckets (www.heckingoodboys.com and heckingoodboys.com)
- Enable "Static website hosting" on www.heckingoodboys.com and redirect to heckingoodboys.com.
- Enable "Static website hosting" on heckingoodboys.com, select "use this bucket to host this website", and use routing rules similar to this:
- Back to Route53 - Create an A record for both www.heckingoodboys.com and heckingoodboys.com using the alias to their respective buckets. (this will be the first option in autocomplete)
Why not just use a CNAME from www.heckingoodboys.com to heckingoodboys.com? AWS says they don't charge for aliases, but they do charge for CNAMEs. So, I used an alias to a bucket instead.