Resilient Cloud Solutions · Topic 1 of 5

High Availability for Compute and DNS

Build highly available compute tiers with multiple AZs, load balancers, Auto Scaling health checks and Route 53 routing policies and health checks.

  • 6 min
In a nutshell
  • Spread across at least two AZs; one AZ failure must not take the service down.
  • ALB is layer 7, NLB is layer 4 with static IPs, GWLB inserts appliances.
  • ALB cross zone balancing is on by default; NLB is off by default.

What it is

High availability (HA) means a workload keeps serving users when a component fails. On AWS the basic unit of failure to design around is the Availability Zone (AZ), a separate data center group inside a Region. A Region is a wider failure domain, which matters for disaster recovery.

For the compute tier the pattern is simple: spread instances across at least two AZs, put a load balancer in front, replace unhealthy instances automatically, and use DNS to steer users away from a failed endpoint.

UsersinternetDNSRoute 53health checksLoad balancerALB in two AZsAuto Scaling groupinstances in each AZ

How it works

Choosing a load balancer

TypeLayerBest for
Application Load Balancer (ALB)7, HTTP and HTTPSPath and host routing, containers, Lambda targets, WebSockets
Network Load Balancer (NLB)4, TCP, UDP and TLSVery high throughput, static IP per AZ, PrivateLink
Gateway Load Balancer (GWLB)3Inserting third party firewalls and inspection appliances

Cross zone load balancing spreads requests evenly across targets in all enabled AZs. It is on by default for an ALB and off by default for an NLB. Without it, an AZ with fewer targets receives the same share of traffic as a larger one and can be overloaded.

Deregistration delay lets in flight requests finish before a target is removed during a deployment or scale in.

Health checks

A load balancer sends health check requests to each target and stops routing to those that fail. An Auto Scaling group uses EC2 status checks by default. Switch its health check type to ELB, so an instance that fails the application check is replaced, not just left out of rotation.

aws autoscaling update-auto-scaling-group --auto-scaling-group-name web-asg \
  --health-check-type ELB --health-check-grace-period 300

The grace period gives new instances time to boot before checks count. Set it too short and healthy instances are killed in a loop.

Put the group in subnets of at least two AZs, and the group keeps the instance count balanced across them. If an AZ fails, the group launches replacements in the surviving zones.

Route 53 routing policies

Amazon Route 53 answers DNS queries and can check endpoint health.

PolicyUse
SimpleOne record, no health based logic
WeightedSplit traffic by percentage, such as a canary release
LatencySend users to the Region with the lowest latency
FailoverPrimary and secondary, switching on health
GeolocationRoute by user country or continent, for compliance or content
GeoproximityRoute by distance with an adjustable bias
Multivalue answerReturn several healthy records, up to eight

Health checks can monitor an endpoint, combine other health checks (calculated), or follow a CloudWatch alarm. The alarm type lets you fail over on things Route 53 cannot reach, such as a private resource.

A failover record uses an alias to a load balancer and evaluates target health.

{
  "Changes": [{
    "Action": "UPSERT",
    "ResourceRecordSet": {
      "Name": "app.example.com",
      "Type": "A",
      "SetIdentifier": "primary",
      "Failover": "PRIMARY",
      "HealthCheckId": "11111111-2222-3333-4444-555555555555",
      "AliasTarget": {
        "HostedZoneId": "Z0000000EXAMPLE",
        "DNSName": "primary-alb-123.us-east-1.elb.amazonaws.com",
        "EvaluateTargetHealth": true
      }
    }
  }]
}

Alias records work at the zone apex, cost nothing for queries to AWS targets and follow the target's IP changes.

DNS caching and faster failover

DNS failover depends on record time to live (TTL) and on resolvers honoring it. Use a short TTL for records you may need to switch. For faster and more predictable failover, use AWS Global Accelerator, which gives static anycast IP addresses and shifts traffic to healthy endpoints without waiting for DNS caches.

Usersstatic anycast IPsGlobal Acceleratorhealth awareRegion Ahealthy endpoint

Amazon CloudFront origin groups offer a similar failover for content: if the primary origin returns chosen error codes, CloudFront requests the secondary.

Multi Region compute

For Regional failure, run a second stack in another Region and use latency or failover routing between them. Keep the stack definition in code, and keep AMIs, container images and configuration replicated to the second Region.

Availability targets and SLAs

A service level agreement (SLA) states an uptime promise. AWS publishes an SLA per service, usually as a monthly uptime percentage. If AWS misses it, you receive service credits and must file a claim; the SLA is not a guarantee that the service stays up.

Translate the business requirement, such as "no more than a few minutes of downtime a year", into a percentage and design to it.

AvailabilityDowntime per yearDowntime per month
99%about 3.65 daysabout 7.3 hours
99.9%about 8.8 hoursabout 44 minutes
99.99%about 53 minutesabout 4.4 minutes

Combine components with two rules.

  • In series (each one is required): multiply. Two components at 99.9% give about 99.8%, so every extra hard dependency lowers the result.
  • In parallel (any one is enough): availability is 1 minus (1 minus a) to the power n. Two independent 99% components give 99.99%.

Multi-AZ and Multi-Region designs put redundant copies in parallel. The math assumes independent failures, so a shared dependency such as a single database or a global control plane caps the result at that dependency's availability. Each extra tier of redundancy adds cost and complexity, so match it to the target.

What to remember for the exam

  • Spread across at least two AZs; one AZ failure must not take the service down.
  • ALB is layer 7, NLB is layer 4 with static IPs, GWLB inserts appliances.
  • ALB cross zone balancing is on by default; NLB is off by default.
  • Use the ELB health check type on the Auto Scaling group so failed applications are replaced.
  • Grace period prevents premature termination of booting instances.
  • Failover routing needs a health check on the primary; alias records can evaluate target health.
  • Weighted records support canary shifts and blue green cutovers at the DNS layer.
  • Global Accelerator avoids DNS caching delays with static anycast IPs.
  • Use a CloudWatch alarm health check for private endpoints.
Exam tip

If the question stresses instant failover despite client DNS caching, choose Global Accelerator over Route 53 failover records.

Common mistakes

Using EC2 status checks only. An instance can pass them while the application is broken.

One AZ for the group. The load balancer and group are redundant on paper but still fail together.

Long TTLs on failover records. Clients keep using the failed address until their cache expires.

Forgetting health checks on failover records. Without one, Route 53 never knows to fail over.

Watch out

A health check path that depends on a downstream database can cascade a database outage into taking every web instance out of service.

Check yourself

  • Why switch an Auto Scaling group to the ELB health check type?

    So that instances failing the application level check are replaced, not only those failing EC2 status checks.

  • Which Route 53 policy fits a primary and standby site?

    Failover routing with a health check on the primary record.

  • What gives static IP addresses and fast Regional failover without DNS caching?

    AWS Global Accelerator with anycast IP addresses.

Topic 1 of 5 in Resilient Cloud Solutions

Test yourself on Resilient Cloud Solutions

The full AWS DOP-C02 question bank has 844 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.