Blue/Green Deployments - Machine Learning Lens

Blue/Green Deployments

The blue/green deployment technique provides two identical production environments. You can use this technique when you need to deploy a new version of the model to production.

As shown in Figure 8, this technique requires two identical environments:

  • A live production environment (blue) that runs version n,

  • An exact copy of this environment (green) that runs version n+1.

While the blue environment (version n) is processing the live traffic, you test the next release (version n+1) on the green environment with synthetic traffic. Tests should include verifying that the new model is meeting both technical and business metrics. If all tests of version n+1 in the green environment are a success, then the live traffic is switched to the green environment. You then validate the metrics again in the green environment, this time with live traffic. If you find any issues in this testing, you switch the traffic back to blue environment. If no issues are found for a period of time, you can remove the blue environment.

Figure 8 – Blue/Green Deployment Technique

Implementing a blue/green deployment on Amazon SageMaker includes these steps:

  1. Create a new endpoint configuration, using the same production variants for the existing live model and for the new model.

  2. Update the existing live endpoint with the new endpoint configuration. Amazon SageMaker creates the required infrastructure for the new production variant and updates the weights without any downtime.

  3. Switch traffic to the new model through an API call.

  4. Create a new endpoint configuration with only the new production variant and apply it to the endpoint.

Amazon SageMaker terminates the infrastructure for the previous production variant.

Figure 9 – Blue/Green Model Deployment with Amazon SageMaker Production Variants