Skip to content

Latest commit

 

History

History

README.md

Multi-Region Configuration Samples

Reference: PRD Sections 4.3-4.5 - Multi-Region Architecture

This directory contains configuration samples for implementing multi-region deployments on the HelpDev platform.

Files

phased-rollout-config.yaml

Defines the phased rollout strategy for deploying services across multiple regions:

  • ConfigMap with rollout configuration defining:

    • Regional deployment order (primary → secondary)
    • Phase definitions with validation criteria
    • Rollback triggers and strategy
    • Service tier overrides
  • Argo Rollout example for canary deployments within a region:

    • Progressive traffic shifting (10% → 25% → 50% → 75% → 100%)
    • Integration with Istio for traffic routing
    • Analysis-driven promotion
  • AnalysisTemplate for deployment validation:

    • Success rate monitoring
    • Latency threshold enforcement

route53-failover.tf

Terraform configuration for DNS-based failover:

  • Health Checks for each region monitoring /healthz endpoint
  • Failover Routing - Primary (us-east-1) with automatic failover to secondary (sa-east-1)
  • Latency-based Routing - Route users to nearest healthy region
  • Weighted Routing - For controlled regional canary deployments
  • CloudWatch Alarms for health check failures

cross-region-replication.tf

Terraform configuration for cross-region data replication:

  • ECR Replication - Automatic container image replication
  • S3 Replication - Artifact and backup replication with versioning
  • Secrets Manager Replication - Infrastructure secret synchronization

Architecture Overview

                    ┌──────────────────┐
                    │    Route53       │
                    │  Health Checks   │
                    └────────┬─────────┘
                             │
              ┌──────────────┴──────────────┐
              │                             │
              ▼                             ▼
    ┌─────────────────┐          ┌─────────────────┐
    │  us-east-1      │          │  sa-east-1      │
    │  (Primary)      │          │  (Secondary)    │
    │                 │          │                 │
    │  ┌───────────┐  │          │  ┌───────────┐  │
    │  │ EKS       │  │          │  │ EKS       │  │
    │  │ eks-prod- │  │          │  │ eks-prod- │  │
    │  │ use1      │  │          │  │ sae1      │  │
    │  └───────────┘  │          │  └───────────┘  │
    │                 │          │                 │
    │  ┌───────────┐  │   ◄───►  │  ┌───────────┐  │
    │  │ ECR       │──┼──────────┼──│ ECR       │  │
    │  │ Replicated│  │          │  │ Replica   │  │
    │  └───────────┘  │          │  └───────────┘  │
    │                 │          │                 │
    │  ┌───────────┐  │   ◄───►  │  ┌───────────┐  │
    │  │ Secrets   │──┼──────────┼──│ Secrets   │  │
    │  │ Manager   │  │          │  │ Replica   │  │
    │  └───────────┘  │          │  └───────────┘  │
    │                 │          │                 │
    │  ┌───────────┐  │   ◄───►  │  ┌───────────┐  │
    │  │ S3        │──┼──────────┼──│ S3        │  │
    │  │ Artifacts │  │          │  │ Replica   │  │
    │  └───────────┘  │          │  └───────────┘  │
    └─────────────────┘          └─────────────────┘

Deployment Strategy

Phase 1: Primary Region

  1. Deploy to us-east-1 (primary)
  2. Run smoke tests
  3. Monitor for 15 minutes
  4. Validate success criteria:
    • 100% pod health
    • <0.1% error rate
    • p95 latency <500ms

Phase 2: Secondary Regions

  1. Deploy to sa-east-1 (secondary)
  2. Run smoke tests
  3. Monitor for 10 minutes
  4. Final validation across all regions

Rollback Triggers

  • Error rate >1% for 5 minutes
  • Pod health <80%
  • p95 latency >2 seconds

Usage

Apply Route53 Failover

cd samples/multi-region

terraform init
terraform plan -var="environment=prod" \
  -var="primary_alb_dns=k8s-prod-use1-xxxx.us-east-1.elb.amazonaws.com" \
  -var="primary_alb_zone_id=Z35SXDOTRQ7X7K" \
  -var="secondary_alb_dns=k8s-prod-sae1-xxxx.sa-east-1.elb.amazonaws.com" \
  -var="secondary_alb_zone_id=Z2P70J7HTTTPLU"
terraform apply

Apply ECR Replication

# Apply from primary region
terraform apply -target=aws_ecr_replication_configuration.cross_region

Configure Phased Rollout

Apply the ConfigMap to the Argo CD namespace:

kubectl apply -f phased-rollout-config.yaml -n argocd

Important Considerations

  1. Region Isolation: Per PRD, regions are isolated - services do NOT communicate across regions
  2. Data Locality: Databases are regional; use Global Tables for DynamoDB if needed
  3. ECR Replication: Automatic for all helpdev-* prefixed repositories
  4. Secrets Replication: Only infrastructure secrets are replicated; application secrets are regional
  5. Health Checks: Use multiple Route53 health checker regions for reliability

Related Samples