In AWS EC2, I have one Application Load Balancer (ALB) alb1-556083996.us-east-1.elb.amazonaws.com
, and two target groups tg-blue
and tg-green
.
In AWS route53, I have two records api.myapp.example.com
and api-blue.myapp.example.com
.
The route53 record api.myapp.example.com
is aliased to api-blue.myapp.example.com
which is alieased to an AWS ALB alb1-123456789.us-east-1.elb.amazonaws.com
.
Both of these two route53 records are latency
based with Evaluate target health
enabled.
The route53 record api.myapp.example.com
also can be aliased to api-green.myapp.example.com
at some point instead of aliasing to api-blue.myapp.example.com
.
I'd like to create following ALB listener rules:
- When the host
api.*
will be pointing toapi-blue.*
, the traffics will be forwarded to the target grouptg-blue
. - When the host '
api.*
will be pointing toapi-green.*
, the traffics will be forwarded to the target grouptg-green
. - The default rule will return a
FIXED_RESPONSE
.
In addition, as Evaluate target health
and latency
based routing have been enabled on both level of aliases, I'd expect the traffics will never be dropped as long as at least one target group has targets registered to it.
I have LB access logs enabled. When I hit api.myapp.example.com
or api-blue.myapp.example.com
, the host api-blue.*
does not appear in the access logs. So, I'm afraid that host-headers
based rule won't work here. I will need a lot of experiments to be able to figure out if the above is working or not.
So, I'm trying to find out whether it is possible or not from someone knowledgable in this area. If it is not possible, how can I achieve this?