I have an AWS EC2 application load balancer with a corresponding backend target group. Is it possible to send traffic to a particular EC2 instance if the source IP matches a given ip address, otherwise send to the default other EC2 instances? Basically I am looking to feature test some code, but only send a small subnet of known ip traffic to that instance with the new code.
Typically the best way to do Canary deployment on AWS is using Route53 weighted routing. However AFAIK that's not sticky, so you can't guarantee the same users will go to the new server each time.
A bit of reading suggests this solution is probably best. You:
- Create a new autoscaling instance
- add the new instance(s) to the load balancer, making sure they have effective health checks
- make sure sticky sessions are enabled on the ALB
I think that will give you canary deployments, with the ability to roll back fairly easily, though not instantly. If you have a small number of instances you may have a fairly large fraction of your traffic going to the new version.
You could always install Nginx, HAProxy or similar and put that in the mix, though that adds complexity.