Menu
Dev.to #architecture·November 29, 2026

Multicloud Resiliency: Agent Failover, DNS Health Checks, and State Management

This article discusses implementing three layers of resilience for a multicloud application, specifically focusing on agent-to-agent communication across AWS and Azure. It covers orchestrator-level agent failover with circuit breaking, DNS-based regional failover using comprehensive health checks, and strategies for managing application state in a multicloud environment.

Read original on Dev.to #architecture

Achieving true resilience in a multicloud setup goes beyond simply deploying the same service in multiple clouds. This article highlights the common pitfalls of naive multicloud deployments and proposes a layered approach to ensure high availability and graceful degradation. The core idea is to build resilience at different levels of the application stack, from individual service agents to DNS routing and state persistence.

Layer 1: Orchestrator-Driven Agent Failover

The first layer of resilience involves the orchestrator actively managing agent availability. Instead of relying on a single endpoint, the orchestrator is configured with multiple candidate endpoints for each agent (e.g., primary in Azure, secondary in AWS). When an agent fails, the orchestrator employs a simple circuit breaker pattern to temporarily quarantine the unhealthy endpoint, preventing repeated attempts and timeouts. It then tries the next available endpoint, ensuring service continuity at the agent level.

python
QUARANTINE_SECONDS = float(os.getenv("AGENT_QUARANTINE_SECONDS", "30"))
_quarantine: Dict[str, float] = {}
def endpoints_from_env(var_list: str, var_single: str, default: str) -> List[str]:
    raw = os.getenv(var_list) or os.getenv(var_single) or default
    return [u.strip().rstrip("/") for u in raw.split(",") if u.strip()]
async def pick_endpoint(candidates, client=None, now=None):
    """Retorna (base_url, agent_card, tentativas). Endpoints em quarentena sao pulados, exceto se todos estiverem."""
    attempts: List[str] = []
    ordered = [c for c in candidates if not is_quarantined(c, now)] or list(candidates)
    own = client is None
    client = client or httpx.AsyncClient(timeout=CARD_TIMEOUT_SECONDS)
    try:
        for base in ordered:
            attempts.append(base)
            try:
                resp = await client.get(f"{base}/.well-known/agent-card.json")
                if resp.status_code == 200:
                    _quarantine.pop(base, None)
                    return base, resp.json(), attempts
            except httpx.HTTPError:
                pass
            mark_failed(base, now)
        return None, None, attempts
    finally:
        if own:
            await client.aclose()

Layer 2: DNS-Based Regional Failover with Comprehensive Health Checks

To handle entire region failures, DNS-level failover is crucial. The article suggests using AWS Route 53 failover records, where a primary record points to one cloud (e.g., AWS ALB) and a secondary to another (e.g., Azure Container Apps). The key architectural insight here is the depth of the health check. Instead of a superficial check on the root path ('/'), the health check should probe an endpoint like '/api/health' that validates the entire application stack, including the orchestrator's ability to discover agents. This ensures that a switchover only occurs when the primary environment is truly unhealthy and not just its frontend.

hcl
resource "aws_route53_health_check" "aws_primary" {
  fqdn = var.aws_alb_dns_name
  port = 80
  type = "HTTP"
  resource_path = "/api/health"
  failure_threshold = 3
  request_interval = 30
}
resource "aws_route53_record" "primary" {
  zone_id = data.aws_route53_zone.public.zone_id
  name = "${var.app_hostname}.${var.route53_zone_name}"
  type = "A"
  set_identifier = "aws"
  health_check_id = aws_route53_health_check.aws_primary.health_check_id
multicloudresiliencefailoverDNShealth checkcircuit breakerhigh availabilityAWS

Comments

Loading comments...