- Newest
- Most votes
- Most comments
Route 53 itself doesn't directly handle redirects from a main domain to a subdomain, especially for HTTPS sites. However, there are several ways to achieve this redirection using AWS services in conjunction with Route 53.
An Application Load Balancer (ALB) can indeed be used to perform this redirection. This is often a preferred method for HTTPS sites because it allows you to manage SSL/TLS certificates and perform the redirection at the application layer. Here's how you could set it up:
- Create an ALB and configure it with the appropriate SSL/TLS certificate for your main domain.
- Set up a listener rule on the ALB to redirect requests from the main domain to the subdomain.
- In Route 53, create an A record for your main domain that points to the ALB (using an Alias record).
- Keep the CNAME record for your subdomain as generated by Amplify.
This setup allows the ALB to handle the HTTPS traffic and perform the redirection, while Route 53 simply routes the traffic to the correct endpoint.
Regarding your question about Amplify generating an A record instead of a CNAME: Amplify typically uses CNAME records for subdomains because they're more flexible for their infrastructure. However, if you need an A record, you might be able to configure this in the Amplify console or by contacting AWS support. That said, for your redirect scenario, keeping the CNAME record for the subdomain should work fine with the ALB setup described above.
It's worth noting that while S3 website hosting can only handle HTTP redirects, using CloudFront in front of your S3 bucket can enable HTTPS for your static site and allow you to set up redirects at the CDN level.
Remember, when dealing with HTTPS redirects, ensure that your SSL/TLS certificates are properly set up for both the main domain and subdomain to avoid any security warnings in browsers.
Sources
Using Amazon Route 53 as the DNS service for subdomains without migrating the parent domain - Amazon Route 53
Amazon Route 53 announces HTTPS, SSHFP, SVCB, and TLSA DNS resource record support - AWS
DNS best practices for Amazon Route 53 | Networking & Content Delivery
Relevant content
- Accepted Answerasked 2 years ago
- Accepted Answerasked 10 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago