Question 4: You are working in an investment broker, who provide online services for the investments and website should be up 24X7. You need to deploy the newer version of application which has support for many new features. You have fleet to EC2 instances which are placed behind ELB and also auto scaling is enabled. What you want that you will be slowly deploying new version of the code and also website should not go down, which of the following combination of strategy will be well suited?
- You will be using Blue/Green deployment strategy.
- You will one by one terminate EC2 instance with old code and replacing it with the new instance having new version of the code.
- Using CloudFromation you will be creating new stack and deploy the new code on existing group of EC2 instances and start new application on existing EC2 instance.
- You will be setting up new ELB and group for EC2 instance with the newer launch configuration, once the deployment is done you will be switching the DNS which will point to newer version of ELB using Route 53.
- In existing auto-scaling you will double the EC2 instances for that you will be have all the instances with the newer version of code. And slowly terminate all the instances with older version of the code.
Correct Answer : A,C
Detailed Explaination: It is upto you which strategy you use to migrate the application on the newer version of the code and it also depend on the architecture you have followed. But as given in the question your entire load is served using EC2 instances which are part of Auto-scaling group and also behind the load balancer. So for the end user perspective single point from which traffic is served is ELB. And the responsible component which divert the traffic the ELB is Route53.
So best solution recommended by AWS as well as you should followed is Blue/Green deployment. And for the given architecture you will be deploying routing request to newer version of deployment.
Older environment will be known as Blue (service production traffic ) and newer version of the code is known as Green. You create entire Green environment using newer Load Balancer and new instances in newer version of auto-scaling group. And change the Route 53 DNS record such that all the new traffic will be routed to newer ELB. If you want to rollback than just update the DNS entry in the Route 53.
Blue/Green deployment in AWS :
- It is a technique for releasing applications by shifting traffic between two identical environments which are running different version of applications.
- This strategy will help in mitigating risk like downtime and rollback capability.
- It provides near zero-downtime releases and rollback capabilities.
- Blue (Current version of application service prod traffic) and green(is staged running different version of app).
- Once everything tested on green environment than entire traffic will be moved to green environment.
- And if there is any issue, you can revert traffic to original blue environment.
- You can test your new application in the prod environment.
- Canary analysis/Canary traffic: using very small fraction of production traffic on green environment.
- It is a good fit for continuous deployment/integration (CI/CD) workflow.
- And even green environment will be launched on new resources.
- Once everything succeed, you will decommission the older version(Blue).