My use case: I have a web application served by an Elastic Load Balancer which is in front of 1 EC2 instance. The architecture aims to simulate a Blue/Green deployment flow, meaning that I will turn on a second instance when I need to update code and switch the one my ELB is pointing at.
Let's assume Instance-A has the current version of my application, my ELB is routing traffic to that instance since it's the only one available. I want to push updates to my app, so I deploy a new version of my application on Instance-B (turn on instance-B and deploy new version of code). Meanwhile any user visiting my application will still be routed to Instance-A and have a session created for until I make the switch.
Once Instance-B is deployed and available with the newer code, how can I ensure that the ELB will send new traffic only on Instance-B, and keep old traffic (previous users and their session) on instanceA until I deregister the latter from the load balancer?
Hope this makes sense, I'm aware this architecture design is not the right implementation of Blue/Green Deployment. But due to the size of my application and the budget, I would like to limit the number of instances I'm using.
Thank you for your help.