- Newest
- Most votes
- Most comments
To achieve the architecture you described, you can use a combination of AWS services to create a flexible and scalable solution that can be easily managed with Infrastructure as Code (IaC) tools. Here's how you can set this up:
-
Use Amazon Route 53 as your DNS service. You can create a hosted zone for your domain (e.g., acme.com) and manage all your subdomains there.
-
Set up an Application Load Balancer (ALB) as your main entry point. This ALB will act as the central point for routing traffic to different backend services based on the incoming requests.
-
Configure listener rules on the ALB to route traffic based on the Host header (which corresponds to the subdomain). Each rule can forward requests to the appropriate target group associated with a specific ECS deployment.
-
For each ECS deployment, create a target group and register the ECS tasks or services as targets.
-
Use AWS Certificate Manager (ACM) to manage SSL/TLS certificates for your subdomains, which can be attached to the ALB for secure communications.
To make it easy to add new entries for new deployments:
-
Create a standardized naming convention for your ECS services and ALB target groups.
-
Use AWS CloudFormation or Terraform to define your infrastructure as code. This will allow you to create reusable templates or modules for deploying new services.
-
When adding a new deployment, you would: a. Deploy the new ECS service b. Create a new target group for the service c. Add a new listener rule to the main ALB to route traffic for the new subdomain to the new target group
This approach allows you to have a single IP address (the ALB's) for multiple subdomains, with the ALB handling the routing to different backend services. It's scalable, manageable via IaC tools, and provides a straightforward way to add new deployments and subdomains as needed.
Sources
Announcing Application Load Balancer for Elastic Load Balancing
Application Load Balancers - Elastic Load Balancing
- You can do all this with 1 ALB or multiple ALBS. The choice is yours
- You can have all DNS Names point to One ALB and then use rules on the ALB to route to different target groups based on the host header.
- You can have different dns domains point to different ALBs which point to a target group.
- You can use a *. wildcard in a route53 zone to send all traffic to 1 ALB
- You can use IAC to manage all this such as Terraform or Cloudformation
- You dont really need a fixed Elastic IP. Your public ALBS will be provided with public IPs. If you wanted too, you can use a global accellerator which provides 2 static IPs.
Multiple ways to acheive what your looking at
hi To route multiple subdomains to different ALBs behind ECS deployments in AWS, use Route 53 for DNS management and Application Load Balancers (ALB) for host-based routing. Create subdomain records in Route 53 (e.g., service1.acme.com), point them to the respective ALB, and use ALB listener rules to forward traffic to different ECS services. Manage everything easily with IaC tools like Terraform or CloudFormation for automated updates when adding new subdomains and deployments.
