2: Reliability and Business Continuity

    Implementing Scalability and Elasticity

    Scalability on AWS is the practice of matching capacity to demand without manual intervention, while elasticity is the speed at which that matching reacts to load changes. The two together determine whether a workload survives an unplanned traffic spike, a slow drift in customer adoption, or a scheduled batch window. The operator's job is to pick the right scaling axis for each layer of the stack: horizontal compute scaling via Auto Scaling groups, request-path acceleration via caches, vertical or horizontal database scaling via managed-database features, and routing-layer recovery via Application Recovery Controller. The wrong axis at the wrong layer wastes money or, worse, leaves a workload single-threaded at exactly the moment it needs to spread out.

    Begin every scaling design with a quantitative answer to three questions. First, what is the load pattern: steady, diurnal, spiky, or seasonal? Second, where does state live, and can that state be replicated horizontally? Third, what is the warm-up time of the slowest component, the JVM that needs five minutes to JIT-compile, the Lambda cold start, the EBS volume that takes minutes to hydrate from a snapshot? The warm-up time tells you whether reactive policies are fast enough or whether predictive scaling needs to pre-warm capacity ahead of load.

    💡 Exam Trap: Reactive policies (target tracking and step scaling) only react after a metric breaches the alarm threshold. If the workload's warm-up time exceeds the breach-to-healthy window, predictive scaling or scheduled actions are the right answer, not a tighter alarm threshold.

    Elasticity also has a downside the exam tests: scaling in too aggressively kills sticky sessions, breaks long-running connections, and discards warm caches. The cooldown period, instance-warmup setting, and lifecycle hooks all exist to make scale-in safe. A correct Auto Scaling configuration treats scale-in events as carefully orchestrated drain operations, not abrupt terminations. Combine instance-warmup with target-tracking policies that suppress scale-in for a configured period after each scale-out so the policy does not flap.

    State placement is the second scalability lever. Compute can scale horizontally only when state lives somewhere else: a managed database, an ElastiCache cluster, a DynamoDB table, an S3 bucket, an EFS file system. Workloads that keep session state on the local disk of each EC2 instance cannot scale in without losing user sessions. The operator should audit every workload for local-state dependencies before claiming the workload is horizontally scalable. CloudWatch dashboards from Chapter 1 are a useful place to surface per-instance request-distribution metrics that expose hidden stickiness.

    Amazon Application Recovery Controller

    Amazon Application Recovery Controller is a routing-control and readiness-check service that lets operators flip traffic between Regions or cells with API calls rather than DNS edits, and that continuously audits a recovery target for drift. It has two surfaces: zonal shift and Route 53 ARC. Zonal shift is the one-API call surface that moves traffic away from a single Availability Zone on an Application Load Balancer, Network Load Balancer, or Elastic Kubernetes Service load balancer. Zonal autoshift extends the same idea by letting AWS shift traffic automatically when AWS detects a Zone impairment. Route 53 ARC is the heavier surface that adds routing controls, control panels, safety rules, and readiness checks across Regions.

    A routing control is a simple on/off switch fronted by a five-Region quorum cluster. The cluster keeps responding even if individual Regions are impaired, so the operator can flip the switch from anywhere that has network connectivity to at least three of the five Region endpoints. Safety rules enforce invariants, for example, never turn off all routing controls at once, never turn off the only routing control whose state is on. Readiness checks compare the configuration of one recovery group cell against another, flagging differences in IAM policies, scaling settings, AMI IDs, or AWS Backup plans that would prevent the standby cell from absorbing production traffic.

    # Start a zonal shift away from us-east-1a for an Application Load Balancer
    aws arc-zonal-shift start-zonal-shift \
     --resource-identifier arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/web-alb/50dc6c495c0c9188 \
     --away-from use1-az2 \
     --expires-in 6h \
     --comment "AZ impairment shift for incident INC-4821"
    
    # List all active zonal shifts in the Region
    aws arc-zonal-shift list-zonal-shifts --status ACTIVE
    

    Routing controls work hand in hand with Route 53 failover records. The Route 53 health check observes the routing control state; flipping the control to Off marks the record unhealthy and the DNS resolver returns the secondary record's answer. Combining a routing control with a Route 53 alias record gives the operator a tested, single-button failover that does not require re-deploying infrastructure or editing DNS at the registrar.

    import boto3
    
    arc = boto3.client('route53-recovery-cluster', endpoint_url='https://example.route53-recovery-cluster.us-west-2.amazonaws.com')
    
    # Flip the primary Region routing control to Off, secondary to On
    arc.update_routing_control_states(UpdateRoutingControlStateEntries=[
     {'RoutingControlArn': 'arn:aws:route53-recovery-control::111122223333:controlpanel/abcd1234/routingcontrol/primary-on', 'RoutingControlState': 'Off'},
     {'RoutingControlArn': 'arn:aws:route53-recovery-control::111122223333:controlpanel/abcd1234/routingcontrol/secondary-on', 'RoutingControlState': 'On'},
    ], SafetyRulesToOverride=[])
    

    📊 Limit: Route 53 ARC clusters are quorum-based with five Regional endpoints. An operator must reach at least three endpoints to mutate routing-control state. Always retry against multiple endpoints, not just the closest one.

    ⚠️ Anti-Pattern: Building a multi-Region failover with only Route 53 weighted records and no readiness checks. The standby Region drifts in AMI IDs, Lambda code versions, and IAM trust policies between failover drills, and the first real failover discovers the drift the hard way. Readiness checks catch the drift before the incident.

    🎯 Scenario: A payments workload runs active in us-east-1 with a warm standby in us-west-2. During an AZ impairment in us-east-1a, the operator first starts a zonal shift away from use1-az2. The shift completes in under a minute and the Application Load Balancer stops sending new connections to the impaired AZ. Existing in-flight requests drain, and the workload stays in us-east-1. Failover to us-west-2 is reserved for Regional events and is triggered by flipping a routing control, not a zonal shift.

    Decision Anchor: Choose zonal shift when the impairment is scoped to a single Availability Zone and traffic should stay in-Region. Choose Route 53 ARC routing controls when the impairment is Regional and traffic must move to a different Region's cell.

    The scaling layers reviewed in the next sections all participate in this recovery story. Auto Scaling groups feed the load balancer that zonal shift moves traffic on. ElastiCache and CloudFront keep request latency low so the surviving capacity can carry the displaced load. RDS Multi-AZ and DynamoDB global tables make the state layer ready for the cell to absorb traffic. The sections that follow walk through each of these in turn, with a running thread back to the recovery primitives introduced here.


    Continue with the interactive course

    Track your progress, jump into practice questions and use the Shark AI tutor inside the AWS - CloudOps Engineer Associate learning hub.