9 Zero Downtime Deployments

 

Zero Downtime Deployments

This chapter covers:

  • Customizing resource lifecycles with the create_before_destroy flag
  • Performing Blue/Green deployments with Terraform
  • Refactoring a flat module workspace into a nested module hierarchy
  • Modifying state with terraform state and terraform import CLI commands

Traditionally, there has been a window of time during software deployments when servers are incapable of serving production traffic. This window is typically scheduled for early morning off-hours to minimize impact, but it’s still downtime from the customer’s perspective. Zero Downtime Deployment (ZDD) describes the practice of keeping services always running and available to customers during software deployments.

ZDD enables developers to deliver software updates and patches to customers without interrupting the user experience. If done well, users may not even be aware that a software update is taking place. Zero downtime deployment means high software availability, and availability is considered the most important criteria for the success of any software. Many customers have come to expect services to be always on an available when they need it. After all, when was the last time you heard of Google or Amazon being down for scheduled maintenance?

9.1       Lifecycle Customizations

9.1.1   Zero Downtime Deployments with create_before_destroy

9.1.2   Additional Considerations

9.2       Blue/Green Deployments

9.2.1   Architecture

9.2.2   Code

9.2.3   Deploy

9.2.4   Blue/Green Cutover

9.2.5   Additional Considerations

9.3       Self Service Resource Provisioning

9.3.1   Architecture

9.3.2   Code

9.3.3   Initial Deployment

9.3.4   Tainting and Rotating Access Keys

9.3.5   Tech Debt and the Need to Refactor

9.4       Advanced Terraform State Concepts

9.4.1   Deep Dive into Serials and Lineages

9.5       Performing State File Surgery

9.5.1   Architecture

9.5.2   Code

9.5.3   Importing and Moving Stateful Data

9.5.4   Redeploy

9.5.5   Importing Resources

9.6       Fireside Chat

9.7       Summary

sitemap