Zero-downtime deployment pattern
📖 Scenario: You are managing a web application hosted on a cloud provider. To avoid downtime during updates, you want to deploy a new version of your application alongside the old one, then switch traffic to the new version only after it is ready.
🎯 Goal: Build a Terraform configuration that creates two identical instances of a web server behind a load balancer. The load balancer should route traffic only to the active instance. You will configure the infrastructure to allow switching traffic from the old instance to the new instance without downtime.
📋 What You'll Learn
Create two compute instances with the same configuration but different names
Create a load balancer with a target group
Attach only one instance to the load balancer target group at a time
Add a variable to select which instance is active
Use the variable to control which instance receives traffic
💡 Why This Matters
🌍 Real World
Zero-downtime deployment is critical for web applications that must remain available during updates. This pattern is used in production environments to avoid service interruptions.
💼 Career
Cloud engineers and DevOps professionals use zero-downtime deployment patterns to ensure high availability and reliability of applications during updates.
Progress0 / 4 steps