AWS Solution for wildcard subdomains (with SSL)
Is there a solution within AWS for implementing a wildcard subdomain (with Route 53). where any subdomain ex1.example.com, ex2.example.com or whatever.example.com can all point to the same server? This server would then have a wildcard SSL cert to allow for the subdomains.
Is this possible?
Solution 1:
Route53 does support wildcards (from the Route53 FAQ):
Q. Does Amazon Route 53 support wildcard entries? If so, what record types support them?
Yes. To make it even easier for you to configure DNS settings for your domain, Amazon Route 53 supports wildcard entries for all record types, except NS records. A wildcard entry is a record in a DNS zone that will match requests for any domain name based on the configuration you set. For example, a wildcard DNS record such as *.example.com will match queries for www.example.com and subdomain.example.com.
You will need to obtain a wildcard SSL certificate separately and host it on any servers accepting these requests.
Solution 2:
Sure AWS can do that.
-
Set a wildcard CNAME record
*.example.com
in Route53 that points to your AWS ELB (Elastic Load Balancer), AWS ALB (Application Load Balancer) or directly to your HTTP Server.If you are using ELB/ALB do not create the wildcard as A-records for the IP addresses as they may change over time. Either create CNAME or ALIAS!
-
If you're using ELB/ALB check out AWS ACM (Amazon Certificate Manager) - it can create and manage free SSL certificates that you can use with ELB/ALB.
-
If you're not using ELB/ALB you will either have to buy a commercial wildcard cert or use LetsEncrypt wildcard certificate, however that's a bit of a pain to renew as the challenge handshake must be done through DNS / Route53.
If your website is at least a little important I suggest you look at ALB + ACM instead of terminating the traffic directly on the web server.
Hope that helps :)