A payments company deploys a stateful Java application onto an Amazon EC2 Auto Scaling group fronted by an Application Load Balancer, orchestrated by AWS CodeDeploy with an in-place deployment that updates instances in batches. The most recent release introduced a regression that only surfaced under production load, and the team had to drain customers off a degraded fleet while the old version was redeployed, causing a long recovery. Leadership now wants the next version stood up on a completely separate set of instances, validated, then cut over with the ability to revert to the untouched original fleet in seconds if metrics degrade. Which CodeDeploy change BEST delivers this fast, low-risk cutover and rollback?
- AKeep the in-place deployment but reduce the batch size to one instance at a time and raise the minimum healthy hosts threshold so that only a small portion of the fleet ever runs the new version at any single moment during the gradual rolling replacement of the existing group.
- BAdd automatic rollback on a CloudWatch alarm to the existing in-place deployment, so when the alarm watching the application error rate breaches its threshold CodeDeploy redeploys the last known good revision back onto the same instances and restores service to affected customers automatically.
- CReplace CodeDeploy with a Route 53 weighted routing policy that splits traffic between two target groups and shift the weight gradually toward the new version, lowering it again if the application begins to return elevated error responses to clients.
- DSwitch the CodeDeploy deployment to the blue/green type so a replacement Auto Scaling group is provisioned with the new version, traffic is shifted to it behind the load balancer after validation, and the original group is kept to allow an immediate reroute back on failure. Correct
Why A is wrong: A smaller in-place batch still mutates the original instances in place, so there is no untouched fleet to fall back to and rollback means redeploying the previous version over the same hosts, which is the slow recovery the team is trying to eliminate.
Why B is wrong: Alarm-based rollback on an in-place deployment reinstalls the prior revision onto the same mutated hosts, which takes as long as a deployment rather than seconds, so it does not provide the instant reroute to a preserved original fleet that blue/green offers.
Why C is wrong: Route 53 weighting shifts traffic at DNS resolution and is subject to client-side caching of records, so cutover and revert are imprecise and slow, and abandoning CodeDeploy loses the managed deployment lifecycle and health-driven automation the team already relies on.
Why D is correct: Blue/green provisions a separate replacement Auto Scaling group, registers it behind the load balancer once health checks pass, and leaves the original group running so CodeDeploy can reroute traffic back to it almost instantly if the new version degrades, exactly matching the fast cutover and rollback requirement.