THE DEV SPECTRUM

← Back to Spectrum

Zero-Downtime Deploys: A Practical Guide to Blue-Green Strategies on AWS

1 min read #CI-CD PK Pramod Krishna

In a CI/CD world, the most dangerous moment is the "Cutover." Blue-Green deployment is the strategy of having two identical production environments. Only one (Blue) is serving live traffic, while the other (Green) is where you deploy the new version.

The Role of the Load Balancer

Using an AWS Application Load Balancer (ALB), you can shift traffic between Target Groups. This is significantly faster than waiting for DNS TTLs to expire.

The Deployment Script

We automate this using a simple shell script within our CI/CD pipeline that updates the ALB Listener Rule:

# Update ALB Target Group to Green environment
aws elbv2 modify-listener \
  --listener-arn ${LISTENER_ARN} \
  --default-actions Type=forward,TargetGroupArn=${GREEN_TARGET_GROUP_ARN}

Why it Matters

By using this pattern, if the Green environment shows a spike in 5xx errors (which we catch with the Prometheus monitoring we set up in our last post!), we can instantly flip the traffic back to Blue with zero impact on the users.

Continue Reading

Read S3 + CloudFront vs Nginx + Docker: Where Should You Host a React App?
#DevOps

S3 + CloudFront vs Nginx + Docker: Where Should You Host a React App?

If a React application becomes static files after npm run build, why do teams still package it inside Docker and serve it through Nginx? Let's compare S3 + CloudFront with Nginx + Docker and understand when each architecture makes sense.

Read post ->