Right now I have a domain (example.com) that I have hosted on Google Domains, but uses Amazon's Route 53 DNS servers, and I've created a hosted zone & registered an SSL certificate for free with ACM. So I got it to take requests for example.com and forwards them to a target group (EC2 instance).
I'd like to expand this into:
staging.example.comprod.example.comwhere each has its own target group it points to.
Is this possible with an ALB? How would I encode this into the load balancer's routing rules?
(Also: would I have to re-verify the SSL cert for the subdomains?)
You route each subdomain to different target group using Listener Rules

When you add a Listener Rule, set a condition for Host header and select the subdomain you want to use e.g. staging.example.com and select Forward to as your target group.

Regarding SSL, you won't need to create a new certificate as long as you have the certificate for *.example.com attached to the listener (see View/Edit certificates)
Yes, it is possible. Just create another recordset in your hosted zone (presumably the same way you did it for example.com) for staging and for prod. As for the certificate issue, you will need a wildcard certificate if you want to use the same certificate for all 3 hosts (example.com, staging.example.com and prod.example.com).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With