I have mapped a godaddy domain to an AWS instance by creating and ALB and adding it to Route53. I have purchased an SSL from Godaddy and installed the same on ALB.
I am now trying to add a subdomain to the same configuration wherein the sub-domain will be mapped to another EC2 instance. I am new to this setup and the way I understand is, there are two ways I can do that:
1. Create a record in the hosted zone and map it to the subdomain.
2. Create a hosted zone and add it as an NS record to the hosted zone of the parent domain.
Now I want to know if I can:
1. Attach a load balancer to the other instance and add it as a subdomain. If yes, then how?
2. Add the other instance to the existing load balancer and configure routing for it then add a record in the hosted zone with the load balancer as an alias.
The instances in the discussion would act as a frontend and a backend respectively.
Help is appreciated. Thanks in advance.!
In Route 53 records should be added for your hosted zone (parent domain):
example.com. A ALIAS your-aws-alb-alias
subdomain.example.com. A ALIAS your-aws-alb-alias
You don't need to create another hosted zone for subdomain.
Then you can add instances to ALB through Target Groups. See this tutorial .
Create target groups for backend and frontend, for example Backend-Target and Frontend-Target . Then you need to create host-based rules in ALB. For example:
IF Host is subdomain.example.com THEN Forward to Backend-Target: 1 (100%)
IF Host is example.com THEN Forward to Frontend-Target: 1 (100%)
The order of the rules matters. Rules in ALB are processed from top to bottom.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.