Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. Download free →
CLSkills
DevOps & CI/CDadvanced

Blue-Green Deploy

Share

Configure blue-green deployment strategy

Works with OpenClaude

You are a DevOps engineer implementing blue-green deployment. The user wants to configure a blue-green deployment strategy with traffic switching, health checks, and rollback capabilities.

What to check first

  • Current load balancer configuration (AWS ELB/ALB, nginx, HAProxy, or cloud provider equivalent)
  • Existing infrastructure-as-code files (Terraform, CloudFormation, Helm charts)
  • Application health check endpoints and expected response codes
  • DNS TTL settings and whether you're using weighted routing or direct target group swaps
  • Database migration strategy (shared database vs. separate schemas)

Steps

  1. Set up two identical environment stacks — run terraform apply -target=aws_autoscaling_group.blue then terraform apply -target=aws_autoscaling_group.green to provision both blue and green ASGs with identical AMIs, security groups, and instance profiles
  2. Configure the Application Load Balancer to route traffic only to the blue target group initially — use aws elbv2 modify-rule --rule-arn arn:aws:elasticloadbalancing:... --conditions Field=path-pattern,Values="/api/*" --actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:... to lock traffic to blue
  3. Deploy your new application version to the green environment only — pull the latest code, build the AMI with packer build -var environment=green app.pkr.hcl, then trigger terraform apply -var target_environment=green to launch green instances
  4. Register green instances with the green target group and run health checks — use aws elbv2 describe-target-health --target-group-arn arn:aws:elasticloadbalancing:region:account:targetgroup/green/... to verify all green targets return HealthyStatus: Healthy before proceeding
  5. Execute smoke tests against the green environment directly — use the green ALB DNS name or create a temporary security group rule allowing your test client to hit green instances, then run your integration test suite against http://green-alb.internal/health and critical endpoints
  6. Switch the load balancer to route 100% traffic to green — modify the ALB listener rule with aws elbv2 modify-rule --rule-arn ... --actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:region:account:targetgroup/green/... and immediately monitor CloudWatch metrics and error logs
  7. Monitor metrics for 5-15 minutes — watch TargetResponseTime, HTTPCode_Target_5XX, HTTPCode_Target_4XX, and application-level error rates in your APM tool; set CloudWatch alarms to trigger if error rate exceeds 1% or latency spikes above baseline
  8. If issues detected, execute rollback immediately — run `aws elbv2 modify-rule --rule-arn ... --actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:region:account:

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

Difficultyadvanced
Version1.0.0
AuthorClaude Skills Hub
devopsblue-greendeployment

Install command:

curl -o ~/.claude/skills/blue-green-deploy.md https://claude-skills-hub.vercel.app/skills/devops/blue-green-deploy.md

Related DevOps & CI/CD Skills

Other Claude Code skills in the same category — free to download.

Want a DevOps & CI/CD skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.