All Glenn
All Glenn

Reputation: 41

How to configure with terraform two ECS clusters in the same VPC?

enter image description here

I am trying to add a new cluster in my vpc by using terraform , this cluster will handle heavy calculation and un other activites. But i have no idea how to configure redirection for request from internet Cluster1 must be sensitive to a cluser1.mydomain.com and cluster to cluster2.mydomain.com

Upvotes: 1

Views: 477

Answers (1)

Marcin
Marcin

Reputation: 238189

General steps are following:

  • Register mydomain.com in Route53 (R53) for example.

  • Create two A alias records (cluser1.mydomain.com and cluser2.mydomain.com) in R53 pointing to ALB DNS.

  • Setup two target groups (TGs) for the ALB. First TG (TG1) for ECS service one, while the TG2 for service two.

  • On the ALB setup single listener (e.g. HTTP 80), with two different rules. For example:

    • Rule one will be based on Host header equal to cluser1.mydomain.com which forwards to TG1.
    • Rule one will be based on Host header equal to cluser2.mydomain.com which forwards to TG2.
    • A compulsory default rule (or use 2 as default rule).

Upvotes: 2

Related Questions