In this article, I’ll explain how to connect your domain on Google domains with your application on AWS using the Application Load Balancer and SSL certificates.
So let’s imagine a situation:
You set up a domain on Google Domains for example superwebsite.com and you have an application on the AWS account. And you wanna point you subdomains to this application. We’ll do it with the Application Load balancer and Certificate Manager for https connection.
For example, you would like to create a subdomain like dev.superwebsite.com. To do all this process go to Certificate Manager on AWS and click on Request Certificate – Request a public certificate and put a domain name – so you should put dev.superwebsite.com. Click Next. As a validation option choose DNS validation.
After this process you should get data like this:
Now go to Google domains – DNS settings – Scroll down to Custom resource records and paste these values. Important things below!!
Put Name to the first field, but remove your main domain from the end! So for example you have value Name: _39ff2309sdf.dev.superwebsite.com from AWS, so in Google domain, you should put _39ff2309sdf.dev. Type: CNAME, Data – put entire Value from AWS.
After 2-10min you pending validation status should be changed on Issued. This means that DNS validation finished successfully.
Now you should be able to create an Application Load Balancer with this certificate. I don’t want to explain how to do this – there’s a lot of documentation about that. In brief – choose Internet Facing LB, add HTTPS listener, choose the right subnets, configure a Security Group (you can open all connections to HTTP and HTTPS from 0.0.0.0/0 it’s ok), configure a target group with a right health check path. If the health check path will be the incorrect status of targets will be unhealthy and the load balancer will not send requests to these instances.
Ok, so your balancer set up and works fine. You can reach an application by the DNS name of your ALB, don’t be scared if https connection says “Insecure” it’s ok. Now you should add one more record to Google domains and point the subdomain to the DNS name of Load Balancer.
In the first field put just subdomain value. For example, if we wanna set up a dev.superwebsite.com you should put dev, type: CNAME, Data: “DNS name of your ALB” (you can copy it from the console in ALB). After that wait 5-10min, your changes will be applied, and you can reach your website with https.