Easy ReviewDOP-C02
Resilient Cloud Solutions77

Elastic Load Balancing

Choose load balancer types and explain listener routing, target health, zonal traffic, and connection handling.

Elastic Load Balancing distributes client traffic to registered targets. These sections cover protocol choices, listener rules, health-based routing, target lifecycle settings, and request troubleshooting.

Elastic Load Balancing basics

Elastic Load Balancing puts one entry point in front of many targets and spreads the traffic among the healthy ones.

How it works

  1. Clients connect to the load balancer.
  2. It checks the health of the registered targets.
  3. It sends each request to a healthy target, across Availability Zones.

Exam cues

  • If the question says distribute traffic across instances or Availability Zones, think Elastic Load Balancing.

Remember

  • Routes only to healthy targets.

Trap: A load balancer spreads traffic; Auto Scaling changes how many instances there are. They are often used together.

From the AWS docs (8)
  • Elastic Load Balancing spreads incoming traffic across targets such as EC2 instances, containers and IP addresses in one or more Availability Zones, and sends traffic only to healthy targets.
  • Application Load Balancers route HTTP and HTTPS requests using request content.
  • Network Load Balancers support TCP, TLS, UDP, TCP_UDP, QUIC, and TCP_QUIC listeners.
  • A Network Load Balancer has a static IP address per enabled Availability Zone; an Elastic IP address can optionally be associated when it is created.
  • Gateway Load Balancers distribute IP traffic to virtual appliances and exchange traffic with them using GENEVE on port 6081.
  • Elastic Load Balancing scales its load balancer capacity as incoming traffic changes, distributes traffic across targets in multiple Availability Zones, and monitors target health to select healthy targets.
  • Application Load Balancers natively support WebSockets: an HTTP/1.1 connection can be upgraded to a persistent ws or wss connection.
  • An ALB can forward a request to a target group whose target is a Lambda function, invoking the function with the request content.

Load balancer types

An Elastic Load Balancing listenerA listener accepts connection requests using a configured protocol and port. is the entry point that accepts connections on a configured protocol and port. A target groupA target group collects registered destinations to which a load balancer can route requests. is a set of destinations, such as EC2 instances, to which listener rules can send traffic.

How it works

  1. Choose the load balancer for the traffic being handled.

    Type Use when Routing detail
    Application Load Balancer (ALB) HTTP or HTTPS request content decides the destination Host, path, headers, method, source IP, or query string
    Network Load Balancer (NLB) Transport protocols or static zonal addresses are required TCP, TLSTLS encrypts traffic between communicating endpoints., UDP, TCP_UDP, QUICQUIC is a transport protocol carried over UDP that an NLB can pass through to targets., or TCP_QUIC listeners
    Gateway Load Balancer (GWLB) Virtual appliances inspect IP traffic GENEVEGENEVE encapsulates packets exchanged between a Gateway Load Balancer and its virtual appliances., a packet encapsulation protocol, on port 6081
  2. Choose the scheme. Internet-facing load balancers accept internet clients through public addresses. Internal load balancers use private addresses and require access to the virtual private cloudA VPC is a logically isolated virtual network for AWS resources. (VPC), an isolated virtual network. Both reach targets through private addresses.

  3. For a regional ALB using Availability Zones, select subnetsA subnet is an address range inside a VPC that belongs to one Availability Zone., address ranges within a VPC, in at least two different zones. Allow a /27 or larger address block and at least eight free IP addresses in each subnet so nodes can scale.

  4. Register targets and configure a listener. ALB rules run in increasing numeric priority; the default runs last when no other rule matches.

  5. End the matching ALB rule with a routing action.

    Action Result
    forward Send to a target group, or divide requests among groups using relative weights
    redirect Tell the client to use a different URL, such as HTTPS
    fixed-response Return a configured HTTP response without a target
  6. Allow listener and health check traffic through security groupA security group is a firewall that controls allowed traffic to and from resources. rules in both directions. A security group is a firewall that controls allowed network traffic.

  7. Elastic Load Balancing creates a node in each enabled Availability ZoneAn Availability Zone is an isolated location within an AWS Region.. Load balancer capacity scales as incoming traffic changes.

    Choose encryption and addresses separately. TLS, the protocol that encrypts a connection, can terminate at an NLB TLS listener or pass through an NLB TCP listener on port 443. A dualstackDualstack allows clients to connect using either IPv4 or IPv6. ALB accepts both IPv4 and IPv6 clients while its target group controls the target address type. For internet clients that need only IPv6, dualstack without public IPv4 avoids public IPv4 addresses; this option requires an internet-facing ALB.

  8. For Lambda targets, the function and target group must share an account and Region.

  9. ALB HTTPS target connections use encryption, but ALB does not validate the target certificate.

  10. Since October 2025, a nondefault ALB rule can rewrite the host header or URL after matching, without changing its routing decision. Since November 2025, an HTTPS rule can validate a JSON Web TokenA token containing claims that ALB can validate before routing a request. (JWT), a signed set of claims, before routing. This requires RS256 signatures and a publicly accessible JSON Web Key Set endpoint that supplies verification keys.

For ECS services on Fargate, the ECS guide lists ALB, NLB, and GWLB as supported types. Choose by protocol or the need to inspect traffic with appliances.

NLB added QUIC and TCP_QUIC listeners in November 2025. QUIC is a transport protocol carried over UDP; an NLB QUIC listener passes that traffic to targets.

For static addresses or AWS PrivateLink with HTTP routing, an NLB can forward to an ALB in the same account and VPC. Use a TCP target group whose port matches the ALB listener. For inspection across VPCs, route application traffic to a Gateway Load Balancer endpoint in a separate subnet from the application servers.

An NLB created without security groups cannot add them later. NLB health checks must be allowed by outbound security group rules.

Since November 2025, NLB default actions can use weighted target groups. Since July 2026, listener rules on dualstack NLBs can route IPv4 and IPv6 clients to different target groups.

An internet-facing load balancer can front the web tier while an internal load balancer serves the private application tier.

Exam cues

  • If the question says route by method or query string, think ALB conditions, because they inspect HTTP request fields.
  • If the question says gradually expose a release, think weighted forward actions, because group weights divide matching requests.
  • If the question says the application must decrypt TLS, think an NLB TCP listener on port 443, because it passes encrypted traffic through.
  • If the question says keep backend instances private, think either load balancer scheme with private targets, because internet access terminates at the internet-facing load balancer.
  • If the backend needs a different path but clients should keep their URL, think a URL rewrite transform, not a redirect.
  • If static IP addresses and path-based routing are both required, think NLB forwarding to an ALB, because the two can combine transport and HTTP features.
  • If a zone loses healthy NLB targets, check cross-zone routing and DNSDNS resolves a name into addresses a client can use to reach the load balancer.: cross-zone is off by default and the zone’s address can be removed.
  • If the question says route part of several ALB paths to different Lambda functions, think one Lambda target group per function and a weighted rule per path, because a Lambda target group holds a single function.

Remember

  • ALB Availability Zone subnets: at least two zones, /27 or larger, eight free addresses per subnet.
  • NLB: static address per enabled zone, with optional Elastic IP association at creation.
  • ALB target group weights: 0 to 999; they are relative weights.
  • The default ALB listener rule runs last.
  • Dualstack describes the client-facing address choice; the target group controls backend addressing.
  • ALB Lambda request body and response JSON limits are 1 MB each.
  • When all registered targets are unhealthy, ALB and NLB can fail openFail open means continuing to route to registered targets even when all are unhealthy. and send traffic to unhealthy targets.
  • HTTPS target groups encrypt traffic from the ALB to its targets.

Trap: An unhealthy weighted ALB target group does not cause automatic failover to the other weighted group. Plan how the group weights will change.

ALB rules select a weighted target group
122ClientALB listenerExisting targetsNew targets
  1. Evaluate listener rules in priority order.

  2. A forward action selects a target group using its configured weight.

From the AWS docs (53)
  • A load balancer receives client requests through listeners and uses listener rules to route them to registered targets in target groups.
  • Application Load Balancers route HTTP and HTTPS requests using request content.
  • Network Load Balancers support TCP, TLS, UDP, TCP_UDP, QUIC, and TCP_QUIC listeners.
  • Gateway Load Balancers distribute IP traffic to virtual appliances and exchange traffic with them using GENEVE on port 6081.
  • An internet-facing load balancer accepts internet traffic through its public addresses.
  • An internal load balancer resolves to private addresses and serves clients with VPC access. In a multi-tier design, an internet-facing load balancer can serve the web tier while an internal load balancer serves the application tier.
  • Both internal and internet-facing load balancers reach targets using private addresses, so targets do not need public addresses.
  • An Application Load Balancer deployed in Availability Zones requires subnets in at least two different Availability Zones.
  • Each Availability Zone subnet for an Application Load Balancer needs a /27 or larger address block and at least eight free IP addresses for scaling.
  • ALB listener rules run from lowest numbered priority to highest, followed by the default rule if no other rule matches.
  • ALB conditions can match host-header, path-pattern, http-header, http-request-method, source-ip, and query-string.
  • An ALB rule ends with exactly one routing action: forward, redirect, or fixed-response.
  • An ALB redirect action sends a client to a different URL and can change HTTP to HTTPS.
  • An ALB fixed-response action returns a configured HTTP response without forwarding the request to a target.
  • An ALB forward action can distribute requests among target groups using relative weights from 0 to 999.
  • Weighted ALB target groups do not automatically fail over to another group when one group is empty or has only unhealthy targets.
  • An NLB TLS listener terminates client TLS and requires a server certificate.
  • An NLB TCP listener on port 443 can pass encrypted TLS traffic through to targets for decryption.
  • ALB supports IPv4, dualstack, and dualstack without public IPv4. Standard dualstack accepts IPv4 and IPv6 clients; dualstack without public IPv4 provides public IPv6 and private IPv4/IPv6 connectivity and requires an internet-facing scheme. Target address types are configured separately.
  • A VPC is a logically isolated virtual network for AWS resources.
  • A subnet is an address range inside a VPC and resides in a single Availability Zone.
  • ALB security group rules must permit listener and health check traffic in both directions.
  • The ECS service guide lists ALB, NLB, and GWLB as supported load balancer types for Fargate services.
  • A security group acts as a firewall controlling traffic allowed to and from an ALB.
  • NLB added QUIC and TCP_QUIC listener support in November 2025.
  • QUIC is a transport protocol carried over UDP; NLB QUIC listeners pass this traffic to targets.
  • An ALB Lambda target and its target group must share an account and Region; request bodies and Lambda response JSON are each limited to 1 MB.
  • ALB does not validate certificates on HTTPS targets, so self-signed or expired certificates can be used for target connections.
  • ALB added host header and URL transforms in October 2025.
  • ALB rule transforms rewrite the host header or URL before forwarding without changing the routing decision; the default rule cannot have a transform.
  • ALB added JSON Web Token validation for service-to-service requests in November 2025.
  • ALB JWT validation requires an HTTPS listener, RS256 signatures, issuer and expiration claims, and a publicly accessible JSON Web Key Set endpoint.
  • An NLB can forward to one ALB per target group for static IP or PrivateLink with HTTP routing; both load balancers must share an account and VPC, and the TCP target group port must match an ALB listener.
  • An NLB created without security groups cannot have them added later; NLB health checks are subject to outbound security group rules.
  • NLB cross-zone load balancing is off by default; without a healthy target in a zone, its address can be removed from DNS.
  • If all targets fail health checks across enabled zones, an NLB fails open and routes to targets regardless of health.
  • An ALB target group with only unhealthy registered targets fails open and routes to those targets.
  • A Gateway Load Balancer endpoint connects consumer and appliance VPCs; consumer route tables direct traffic to the endpoint, which must be in a different subnet from application servers.
  • In July 2026 NLB added listener rules that route IPv4 and IPv6 clients to separate target groups.
  • NLB listener rules require dualstack and match the source IP address type, IPv4 or IPv6, rather than the CIDR ranges supported by ALB source-ip conditions.
  • In November 2025 NLB added weighted target groups for default actions.
  • An ALB target group of type lambda holds one Lambda function; to replace the function, AWS recommends a new target group and an updated listener rule.
  • In an ALB host condition, *.example.com matches test.example.com but not example.com; host matching is not case-sensitive, while path patterns are case-sensitive.
  • A path-pattern condition routes by URL path, so one ALB can send /orders/* and /products/* to different target groups.
  • When NLB targets are registered by instance ID, traffic goes to the primary private IP address of the instance primary network interface.
  • An ALB target group can use protocol version HTTP/1.1 (default), HTTP/2 or gRPC; gRPC requires targets that support it.
  • A target group of type ip can register on-premises servers reached through Direct Connect or Site-to-Site VPN, so one ALB can front AWS and on-premises targets.
  • Classic Load Balancers do not support Server Name Indication (SNI); to serve several HTTPS sites, use one certificate with a Subject Alternative Name for each site.
  • An Application Load Balancer needs subnets in at least two Availability Zones, each with at least a /27 CIDR and eight free IP addresses so the load balancer can scale.
  • A Network Load Balancer can be created with subnets in just one Availability Zone; it handles requests when each enabled zone has a healthy target.
  • Classic Load Balancers are the previous generation of Elastic Load Balancing; AWS recommends migrating to a current-generation load balancer.
  • Enabling an Availability Zone causes Elastic Load Balancing to create a load balancer node in that zone.
  • An Application Load Balancer target group can use HTTPS, so the load balancer opens TLS connections to its targets.

Target health and fail open

An ALB health check evaluates a target’s response. Health thresholds decide when to avoid a target or change routing when too little healthy capacity remains.

How it works

  1. Configure the health check protocol, port, path, and thresholds for the target groupA target group collects registered destinations to which a load balancer can route requests.. The defaults are HTTP GET on the traffic port and path / for HTTP target groups.

  2. The response code must match the configured success codes, which default to 200.

  3. Set minimum healthy counts or percentages for the actions below.

    Action or measurement Meaning
    DNSDNS resolves a name into addresses a client can use to reach the load balancer. failover Stop advertising the affected zone node as healthy in DNS, the system that maps names to addresses
    Routing failover Try all targets available to the node, including unhealthy ones
  4. If all registered targets are unhealthy across enabled zones, ALB fails open: it continues sending requests to them regardless of health.

  5. NLB checks UDP and QUICQUIC is a transport protocol carried over UDP that an NLB can pass through to targets. services using TCP, HTTP or HTTPS checks. Make the check endpoint reflect the actual service’s health.

Exam cues

  • If the question says every registered target failed health checks, think fail openFail open means continuing to route to registered targets even when all are unhealthy., because ALB still tries the targets.
  • If the question says remove a zone from DNS before capacity is exhausted, think DNS failover thresholds, because they control the health of the zone node in DNS.
  • If the question says lower the healthy target threshold for trying all targets, think routing failover, because it broadens target selection below that threshold.
  • If an NLB UDP service fails while its health endpoint still succeeds, make that endpoint report the UDP service state.

Remember

  • Default healthy count threshold: 1 for both failover actions; percentage thresholds default to off.
  • DNS failover thresholds must be greater than or equal to routing failover thresholds.
  • When count and percentage thresholds are both set, either breach triggers that action.

Trap: Health checks are not a security boundary that blocks all access to unhealthy targets. ALB can fail open.

From the AWS docs (8)
  • ALB health checks default to HTTP GET on the traffic port, with path / for HTTP target groups.
  • If every registered target in an ALB target group is unhealthy across enabled zones, ALB routes to all of them regardless of health.
  • ALB DNS failover marks a zone node unhealthy in DNS when its healthy target count or percentage falls below the configured threshold.
  • ALB routing failover sends traffic to all targets available to a node, including unhealthy ones, when the healthy target threshold is breached.
  • The default minimum healthy target count is 1 for both DNS failover and unhealthy-state routing; percentage thresholds are off by default.
  • ALB DNS failover thresholds must be at least as high as routing failover thresholds; if both count and percentage are configured, either breach triggers the action.
  • NLB health checks for UDP and QUIC services use TCP, HTTP, or HTTPS; the checked service should reflect the UDP or QUIC application's availability.
  • An ALB target passes its health check only if the response code is in the target group's success codes, 200 by default.

Cross-zone balancing

Cross-zone load balancingCross-zone load balancing lets a load balancer node route to targets across enabled Availability Zones. controls which Availability Zones a load balancer node can use for targets. An Availability ZoneAn Availability Zone is an isolated location within an AWS Region. (AZ) is an isolated location within a Region; a node is the load balancer endpoint serving one zone.

How it works

  1. Requests arrive at a load balancer node in an enabled zone.

  2. With cross-zone balancing enabled, the node can choose targets across enabled zones. With it disabled, the node uses only its own zone.

  3. Target selection still follows the routing algorithm. Cross-zone balancing expands the target pool without guaranteeing identical traffic to every target. Choose the setting at the supported level.

    Type Default Where to change it
    ALB Enabled at the load balancer; inherited by target groupsA target group collects registered destinations to which a load balancer can route requests. Override per target group
    NLB Disabled Load balancer setting
    GWLB Disabled Load balancer setting
  4. If traffic stays within each zone, provide capacity in each participating zone. Unequal target counts can create unequal per-target load. For an ALB target group with cross-zone disabled, an empty zone produces HTTP 503 responses for requests entering that zone.

Exam cues

  • If the question says targets in one NLB zone are overloaded despite spare capacity elsewhere, think cross-zone balancing, because disabled nodes cannot use the other zones’ targets.
  • If the question says disable ALB cross-zone balancing, think target group override, because the load balancer level is always enabled.
  • If the question says an empty ALB zone returns 503, think missing zonal targets with cross-zone disabled, because that node cannot use another zone.

Remember

  • ALB: always on at the load balancer, inherited by target groups unless overridden.
  • NLB and GWLB: off by default.
  • ALB cross-zone traffic has no regional data transfer charge; NLB cross-zone traffic incurs regional data transfer charges.

Trap: Turning off cross-zone balancing does not balance capacity between zones. Every participating zone needs its own target capacity.

Cross-zone balancing lets a node reach another zone
Availability Zone AAvailability Zone Blocal1cross-zone on2ALB nodeLocal targetOther zone target
  1. A node can use targets in its own zone.

  2. With cross-zone enabled, it can also use targets in other enabled zones.

From the AWS docs (8)
  • Cross-zone load balancing lets a node select targets across enabled zones; without it, selection stays in its own zone. Target selection still follows the load balancer routing algorithm, so enabling cross-zone routing does not itself guarantee identical traffic per target.
  • ALB cross-zone balancing is always enabled at the load balancer level; target groups inherit that setting by default but can override it.
  • NLB and GWLB cross-zone balancing is disabled by default.
  • When cross-zone balancing is disabled, unequal zonal target counts can cause unequal per-target traffic even if nodes receive equal traffic.
  • With ALB target group cross-zone balancing disabled, requests entering an enabled zone with no targets receive HTTP 503 errors.
  • ALB target stickiness and Lambda targets are not supported when target group cross-zone balancing is disabled.
  • An Availability Zone is an isolated location in an AWS Region.
  • ALB has cross-zone balancing always on and charges no regional data transfer for it; an NLB with cross-zone balancing enabled pays regional data transfer between Availability Zones.

Draining, slow start, and stickiness

ALB target groupA target group collects registered destinations to which a load balancer can route requests. attributes control how targets enter service, leave service, and keep a client’s requests together. DrainingDeregistration delay gives active requests time to finish while a target is being removed. means finishing active work after new requests stop. Slow startSlow start gradually increases the traffic share sent to a newly healthy target. spreads a new target’s warm-up over time. StickinessSession affinity uses cookies to keep a client session routed to one target., also called session affinity, uses cookies to keep a session on one target.

How it works

  1. A newly healthy target normally receives its full share of requests. Enable slow start to raise that share linearly over a configured duration. A newly registered target needs another healthy target outside slow start.

  2. Select a routing algorithm.

    Slow start cannot be combined with least outstanding requests or weighted random. Weighted random also cannot be combined with sticky sessions.

  3. Enable stickiness per target group if a client session needs one target. Duration-based stickiness uses AWSALB. Application-based stickiness uses the configured application cookieA cookie is a value a client returns with later requests to carry session information. plus a load balancer cookie. A cookie is a value the client returns with later requests.

  4. Deregister a leaving target. It enters draining, stops receiving new requests, and allows active work to complete. The default delay is 300 seconds before it becomes unused.

  5. If a duration-based cookie points to an unhealthy or deregistered target, ALB chooses a new target and updates the cookie.

Session stateSession state is user data retained between requests while an application is in use. is the application data retained between a user’s requests. A shared store such as DynamoDB or ElastiCache keeps it independent of an application instance, so it can survive that instance’s failure.

Exam cues

  • If the question says active requests fail during removal, think deregistration delay and target shutdown behavior, because closing connections before draining finishes can cause 500-level errors.
  • If the question says a new target needs warm-up, think slow start with a compatible algorithm, because it raises the target’s share gradually.
  • If the question says each request in a session should use one target, think stickiness, because cookies identify the selected target.
  • If the question says sessions must survive a failed target, think a shared session store, because routing affinity does not preserve instance-local data.
  • If the question says keep a weighted ALB test small, think leave target group stickiness off, because the AWSALBTG cookie keeps clients on the group they first reached.

Remember

  • Deregistration delay: 300 seconds by default, configurable from 0 to 3600 seconds.
  • Slow start: disabled by default with value 0; enabled range 30 to 900 seconds.
  • Stickiness: disabled by default, enabled per target group.
  • Duration-based cookie: AWSALB.
  • NLB stickiness follows the client source IP; clients behind one NAT reach one target.

Trap: Stickiness does not keep a failed target available. ALB selects another target when the duration-based cookie points to an unhealthy or deregistered target.

From the AWS docs (14)
  • ALB stops new requests to a deregistering target while allowing in-flight work to finish during deregistration delay.
  • ALB deregistration delay defaults to 300 seconds and supports 0 to 3600 seconds.
  • A deregistering ALB target enters draining and later unused; a connection closed by the target before the delay ends can produce a 500-level client response.
  • ALB slow start linearly increases the request share sent to a newly healthy target.
  • ALB slow start defaults to 0 seconds, meaning disabled; the enabled duration range is 30 to 900 seconds.
  • A newly registered ALB target enters slow start only when another healthy target is outside slow start.
  • ALB slow start cannot use least outstanding requests or weighted random; weighted random also cannot use sticky sessions.
  • ALB stickiness binds a client session to a target through cookies, is enabled per target group, and is disabled by default.
  • ALB duration-based stickiness uses AWSALB; application-based stickiness requires the configured application cookie and a load balancer-generated cookie.
  • If the ALB duration-based cookie refers to an unhealthy or deregistered target, the load balancer selects a new target and updates the cookie.
  • A shared session store such as DynamoDB or ElastiCache keeps session data independent of an application instance and preserves it when that instance fails.
  • Session state is user data retained between requests during use of an application.
  • Weighted target groups do not honor sticky sessions by default. With target group stickiness enabled on the rule, an AWSALBTG cookie keeps a client on the target group it first reached for the configured duration.
  • Network Load Balancer sticky sessions follow the client source IP address, so all clients behind one NAT device reach the same target.

Error metrics and access logs

ALB metrics show trends in errors, connections, and response time. Access logs record individual requests so an operator can investigate which clients and targets were involved. Connection metadata carries the original client information through a load balancer.

How it works

  1. Compare the error metrics using the Sum statistic.

    Signal What it measures
    HTTPCode_ELB_5XX_Count 5XX responses generated by ALB
    HTTPCode_Target_5XX_Count 5XX responses generated by targets
  2. Enable access logs and select an S3 bucket. The compressed logs include client addresses, paths, latencies, and responses.

  3. For HTTP client addresses, use X-Forwarded-For, a request header containing address information. ALB defaults to append; preserve leaves the header unchanged and remove deletes it. Trust entries only when secured network systems added them.

  4. For NLB TCP connection metadata, enable Proxy Protocol v2Proxy Protocol v2 carries connection metadata in a binary header before application data. only after the target can parse its binary header. NLB adds this header before TCP data and includes it in health check connections too.

Exam cues

  • If the question says 5XX responses rose after deployment, think compare ALB and target counters, because they distinguish response origin.
  • If the question says investigate one client’s failed request, think S3 access logs, because they contain request details.
  • If the question says recover client addresses for HTTP behind ALB, think X-Forwarded-For, because it carries addresses through the proxy.
  • If the question says a TCP backend needs source and destination metadata, think Proxy Protocol v2, because its binary header carries connection information.

Remember

  • ALB access logs are disabled by default.
  • ALB and target 5XX counters exclude each other’s responses.
  • Default X-Forwarded-For mode: append.
  • Proxy Protocol v2 requires a compatible parser on the target.

Trap: An ALB-generated 5XX identifies who produced the response. A failed connection to a target can still be involved; inspect connection metrics and request logs.

From the AWS docs (11)
  • HTTPCode_ELB_5XX_Count counts 5XX responses generated by ALB, excluding target-generated responses.
  • HTTPCode_Target_5XX_Count counts 5XX responses generated by targets, excluding load balancer-generated responses.
  • Sum is the useful statistic for ALB and target 5XX count metrics.
  • TargetConnectionErrorCount counts failed connections between ALB and targets and excludes failed health check connections.
  • ALB access logs are optional and disabled by default; enabling them stores compressed request logs in a specified S3 bucket.
  • ALB access logs include client addresses, request paths, latencies, and responses; target_status_code records a target response only if a connection was established and the target sent a response.
  • ALB X-Forwarded-For carries client IP information; append is the default mode, while preserve leaves the header unchanged and remove deletes it.
  • X-Forwarded-For entries are trustworthy only when added by properly secured systems in the network.
  • NLB Proxy Protocol v2 adds binary connection metadata, including source and destination, before TCP data.
  • Targets must parse Proxy Protocol v2 before it is enabled; the header is included on health checks and can break checks when unsupported.
  • ALB connection idle timeout defaults to 60 seconds and can be set from 1 to 4000 seconds; HTTP/2 PING frames do not reset it.

ALB authentication and certificates

An Application Load Balancer can do two jobs that apps often repeat: signing users in, and serving the right TLSTLS encrypts traffic between communicating endpoints. certificate for each domain.

How it works

  1. Add an authenticate-cognito or authenticate-oidc action before the forward action in an HTTPS listenerA listener accepts connection requests using a configured protocol and port. rule.
  2. Unauthenticated users are redirected to the identity provider; after sign-in, the ALB sets a secure session cookieA cookie is a value a client returns with later requests to carry session information..
  3. For several domains, add their certificates to the HTTPS listener’s certificate list; the client’s SNI hostname selects the certificate.

Exam cues

  • If the question says sign users in at the load balancer, social or corporate identities, no app changes, think ALB authentication with Cognito or OIDC.
  • If the question says several HTTPS domains on one load balancer, think the certificate list with SNI.

Remember

  • Authentication actions need an HTTPS listener.
  • Cognito user pools bring social and SAML identities; OIDC IdPs connect directly.
  • SNI lets one listener serve many certificates.

Trap: Sign-in at the load balancer is an Application Load Balancer listener rule action, and only on HTTPS. An HTTP listener, or a load balancer type without listener rules for it, can’t do it.

From the AWS docs (4)
  • An Application Load Balancer can authenticate users before routing requests, so applications don't have to implement sign-in themselves.
  • ALB authentication works with OIDC-compliant identity providers directly, or with Amazon Cognito user pools for social sign-in (Amazon, Facebook, Google) and corporate SAML, OIDC or OAuth identities.
  • The authenticate-cognito and authenticate-oidc listener rule actions are supported only on HTTPS listeners, and the ALB keeps the user signed in with a secure session cookie.
  • An ALB HTTPS listener's certificate list lets one load balancer serve multiple domains on the same port with a different certificate per domain, chosen through Server Name Indication (SNI).

Load balancer configuration and diagnostics

Application Load Balancer (ALB) and Network Load Balancer (NLB) settings have compatibility rules that affect routing and health checks. Check those rules when a target does not receive traffic or a listenerA listener accepts connection requests using a configured protocol and port. cannot be configured.

How it works

  1. For an ALB target groupA target group collects registered destinations to which a load balancer can route requests., choose a routing algorithm. Round robin is the default; least outstanding requests chooses the target with the least work in progress. Slow startSlow start gradually increases the traffic share sent to a newly healthy target. cannot use least outstanding requests or weighted random, and weighted random cannot use sticky sessions.
  2. With slow start, a newly registered target needs another healthy target outside slow start. Already healthy targets and the first batch registered together in an empty target group do not enter slow start.
  3. Check cross-zone compatibility: disabling it on an ALB target group does not support target stickinessSession affinity uses cookies to keep a client session routed to one target. or Lambda targets. For a Lambda target, the function resource policy must grant elasticloadbalancing.amazonaws.com the lambda:InvokeFunction action. AWS recommends restricting it with aws:SourceArn and aws:SourceAccount.
  4. Check NLB listener prerequisites. QUICQUIC is a transport protocol carried over UDP that an NLB can pass through to targets. and TCP_QUIC require an IPv4 NLB without security groupsA security group is a firewall that controls allowed traffic to and from resources.. They cannot coexist with UDP or TCP_UDP listeners, and only one QUIC or TCP_QUIC listener is allowed per NLB. On a dualstackDualstack allows clients to connect using either IPv4 or IPv6. NLB, listener rules match the source address type, IPv4 or IPv6, rather than a specific CIDR range.
  5. Check the target’s health check settings and response. An ALB target must pass an initial check before normal traffic. Its health check Host header uses the target’s private IP and includes the health check port when it is nondefault, so a default virtual host may be needed. NLB HTTPS checks against a target supporting only TLSTLS encrypts traffic between communicating endpoints. 1.3 fail; the target must also support an earlier version, such as TLS 1.2.

Exam cues

  • If the question says a new ALB target needs slow start with least outstanding requests, think round robin, because the default algorithm is compatible with slow start.
  • If the question says an ALB cannot invoke a Lambda target, check its function resource policy, because ELB needs permission to invoke it.
  • If the question says an NLB rule must distinguish IPv4 from IPv6 clients, think a dualstack NLB listener rule, because it matches the source address type.
  • If the question says an ALB health check fails on a name-based virtual host, check the Host header, because it contains the target private IP rather than the public domain name.
  • If the question says an NLB HTTPS check fails against a TLS 1.3-only target, enable an earlier TLS version on the target, because the check requires it.

Remember

  • ALB instance and IP target health checks default to a 30-second interval and a 5-second timeout.
  • ALB defaults to two consecutive failures to mark a target unhealthy and five consecutive successes to recover; initial registration needs one successful check.
  • Deregistration reduces HealthyHostCount without increasing UnHealthyHostCount.
  • An NLB allows one QUIC or TCP_QUIC listener, with no security groups or UDP or TCP_UDP listeners.
  • TargetConnectionErrorCount excludes health check connections; TargetResponseTime is seconds to the first response header.
  • ALB access logs need a same-Region S3 bucket with SSE-S3 and a policy granting the log delivery principal s3:PutObject.
  • Client keepaliveThe maximum time ALB maintains a persistent HTTP client connection before accepting one more request and closing it gracefully. (default 3600 seconds) limits persistent connections; lowering it helps clients leave a zone after a zonal shift.

Trap: Enabling slow start does not make the first batch registered together in an empty ALB target group ramp up. A new target needs another healthy target outside slow start.

From the AWS docs (23)
  • ALB target stickiness and Lambda targets are not supported when target group cross-zone balancing is disabled.
  • ALB slow start does not apply to already healthy targets when enabled, or to the first batch registered together in an empty target group.
  • A newly registered ALB target enters slow start only when another healthy target is outside slow start.
  • ALB defaults to round robin; least outstanding requests selects targets with the least in-progress work, and weighted random is another algorithm.
  • ALB slow start cannot use least outstanding requests or weighted random; weighted random also cannot use sticky sessions.
  • An ALB Lambda target needs a function resource policy granting elasticloadbalancing.amazonaws.com lambda:InvokeFunction; AWS recommends restricting it with aws:SourceArn and aws:SourceAccount.
  • NLB QUIC and TCP_QUIC listeners require an IPv4 NLB without security groups, cannot coexist with UDP or TCP_UDP listeners, and are limited to one such listener per NLB.
  • NLB listener rules require dualstack and match the source IP address type, IPv4 or IPv6, rather than the CIDR ranges supported by ALB source-ip conditions.
  • For ALB instance and IP targets, the default health check interval is 30 seconds and the timeout is 5 seconds.
  • ALB defaults are two consecutive failures to mark a target unhealthy and five consecutive successes to recover an unhealthy target.
  • ALB health checks periodically test registered targets; targets must pass an initial health check before receiving normal traffic.
  • Deregistering an ALB target reduces HealthyHostCount but does not increase UnHealthyHostCount.
  • An ALB health check Host header contains the target private IP address and, for a nondefault port, the health check port; virtual hosts may need a default configuration.
  • NLB HTTPS health checks fail against targets that support only TLS 1.3; targets must also support an earlier version such as TLS 1.2.
  • HTTPCode_ELB_5XX_Count counts 5XX responses generated by ALB, excluding target-generated responses.
  • Sum is the useful statistic for ALB and target 5XX count metrics.
  • TargetConnectionErrorCount counts failed connections between ALB and targets and excludes failed health check connections.
  • TargetResponseTime measures seconds from ALB sending a request until the target starts sending response headers.
  • An ALB access log bucket must be in the same Region as the load balancer and use SSE-S3 as its only supported server-side encryption option.
  • The ALB access log bucket policy must allow s3:PutObject to the log delivery service principal on the log path containing the load balancer account ID.
  • ALB access logs are optional and disabled by default; enabling them stores compressed request logs in a specified S3 bucket.
  • ALB access logs include client addresses, request paths, latencies, and responses; target_status_code records a target response only if a connection was established and the target sent a response.
  • ALB HTTP client keepalive defaults to 3600 seconds; existing connections retain their original value when the setting changes, and a lower duration can help clients reconnect after a zonal shift.

Flashcards

tap to flip
Answer

·

All 77 cards as a list

A web app runs on EC2 instances in two Availability Zones. Which service spreads requests across them and skips unhealthy instances?

Elastic Load Balancing.

When should an application use an ALB, NLB, or GWLB?

ALB for HTTP request routing; NLB for transport protocols and static zonal addresses; GWLB for virtual inspection appliances using GENEVE on port 6081.

How does Elastic Load Balancing improve the availability of an application on EC2 instances in two Availability Zones?

It spreads traffic across the instances in both AZs and sends requests only to healthy ones.

Which load balancer supports path-based and host-based routing, WebSockets, and Lambda functions as targets?

The Application Load Balancer. It routes on HTTP content, upgrades connections to WebSockets, and can invoke a Lambda function from a target group.

When incoming application traffic grows, how does Elastic Load Balancing adjust the capacity of the load balancer itself?

Elastic Load Balancing scales load balancer capacity automatically as traffic changes.

An ALB must route requests by HTTP method and query string. Which feature handles this?

Listener rule conditions. ALB can match http-request-method and query-string alongside host, path, header, and source IP conditions.

Two ALB listener rules match a request. Which rule runs, and when is the default used?

The matching rule with the lowest numbered priority runs. The default runs last if no other rule matches.

A team wants to move a small share of ALB requests to a new release without DNS changes. What should it configure?

A forward action with weighted target groups. Relative weights control the share sent to each group.

An ALB forwards to weighted target groups, and one group becomes unhealthy. Does ALB send that group's share to the healthy group?

No. Weighted forwarding does not automatically fail over between target groups.

An NLB must leave TLS decryption to the application. Which listener should it use?

A TCP listener on port 443. A TLS listener terminates client TLS at the NLB.

An ALB must redirect HTTP clients to HTTPS and return a maintenance message for another route. Which actions fit?

Use redirect for HTTP to HTTPS and fixed-response for the maintenance response.

An ALB in Availability Zones cannot scale because subnet addresses are exhausted. What subnet headroom does AWS require?

A /27 or larger address block and at least eight free IP addresses per ALB subnet, across at least two different Availability Zones.

Must EC2 targets behind an internet-facing Application Load Balancer have public IP addresses?

No. Both internet-facing and internal load balancers reach targets through private addresses.

An ALB must accept IPv6 clients while retaining IPv4 targets. Which address settings fit?

Use a dualstack ALB with an IPv4 target group. Client and target address types are configured independently.

An application tier behind an ALB should accept traffic only from clients with VPC access. Which load balancer scheme fits?

Internal. Its DNS name resolves to private load balancer addresses.

An ALB listener works, but health checks fail after a port change. Which network rules should the team inspect?

Security group rules for the listener and health check ports. ALB requires the traffic to be allowed in both directions.

Which load balancer types does the ECS service guide list for services on Fargate?

Application, Network, and Gateway Load Balancers. Choose according to the application protocol or appliance inspection requirement.

Can an Application Load Balancer forward a 2 MB request body to a Lambda target in another account?

No. The Lambda function and target group must share an account and Region, and the request body limit is 1 MB.

Does an Application Load Balancer validate the certificate of an HTTPS target?

No. ALB accepts target certificates even when self-signed or expired.

An Application Load Balancer must change a request path for a backend without changing the client URL or routing decision. What feature fits?

Use a URL rewrite transform on a nondefault listener rule. ALB added transforms in October 2025.

An Application Load Balancer must validate service-to-service JWTs before routing. What must be configured?

An HTTPS listener rule with JWT validation, RS256 tokens and a publicly accessible key set endpoint. ALB added this capability in November 2025.

A service needs AWS PrivateLink and static IP addresses plus HTTP path routing. How can NLB and ALB be combined?

Register the ALB in an NLB target group of type alb. Both must share an account and VPC; use TCP and match the ALB listener port.

A team created an NLB without security groups and later needs to filter its traffic with one. Can it add a security group?

No. An NLB created without security groups cannot have them added later.

An NLB has cross-zone routing disabled and a zone loses all healthy targets. What happens to that zone's DNS address?

It can be removed from DNS. Cross-zone load balancing is off by default.

Every registered target in an ALB target group is unhealthy. Does the ALB stop sending requests to them?

No. It fails open and routes to the unhealthy registered targets.

Every NLB target fails health checks across enabled zones. What does the NLB do?

It fails open and routes to targets regardless of health.

How can a Gateway Load Balancer inspect traffic from an application VPC using appliances in another VPC?

Create a Gateway Load Balancer endpoint in a separate subnet from the application servers and route the application traffic to that endpoint.

Can an NLB send IPv4 and IPv6 clients to different target groups and distribute traffic by weights?

Yes. A dualstack NLB can use IP address type rules, added in July 2026, and weighted default actions, added in November 2025.

An NLB target becomes unhealthy after its NLB security group outbound rules change. What should the team check?

Allow the health check traffic in the NLB security group's outbound rules.

An ALB serves five API paths from EC2 instances and must send a small share of each path to its own Lambda function. How many Lambda target groups are needed, and where are the weights set?

Five Lambda target groups, one per function. Each path gets its own listener rule whose forward action weights that Lambda group against the instance target group.

Which hostnames does the ALB host condition *.example.com match: example.com, test.example.com, or example.test.com?

Only test.example.com. The wildcard needs a label in front of example.com, so the bare domain does not match. Host matching ignores case.

Requests to /orders must reach one microservice and requests to /products another, behind one load balancer. Which ALB routing fits?

Path-based routing: listener rules with path-pattern conditions that forward to a separate target group per service. Host-based routing would split by domain name instead.

An NLB target group registers EC2 instances by instance ID. Which IP address receives the traffic?

The primary private IP address of each instance primary network interface, not a public or Elastic IP.

Microservices talk to each other with gRPC behind a load balancer. Which load balancer and setting fit?

An Application Load Balancer with a target group whose protocol version is gRPC.

A hybrid app must send part of its traffic through an ALB to servers in a data center connected by Direct Connect. Which target type allows it?

The ip target type, which accepts private IP addresses of on-premises servers reachable over Direct Connect or Site-to-Site VPN.

A Classic Load Balancer must serve HTTPS for app.example.com and shop.example.org. Can it pick a certificate per hostname with SNI?

No. Classic Load Balancers do not support SNI. Use one certificate with a Subject Alternative Name per site, or move to an ALB or NLB, which support SNI.

What subnet requirements does an Application Load Balancer have?

Subnets in at least two AZs, each with at least a /27 CIDR and eight free IP addresses for scaling. An NLB can use a single AZ.

How does Elastic Load Balancing provide an entry point in each enabled Availability Zone?

It creates a load balancer node in each enabled Availability Zone.

An Elastic Load Balancing design has public web servers and application servers that should accept only private traffic from the web tier. Which load balancer schemes fit?

Use an internet-facing load balancer for the web tier and an internal load balancer for the application tier.

Compliance requires encryption between an Application Load Balancer and its EC2 targets, not only from clients. How?

Use an HTTPS target group, so the ALB opens TLS connections to the targets.

Every registered target in an ALB target group fails health checks across all enabled zones. Where does traffic go?

To all registered targets regardless of health. ALB fails open, so health checks do not provide a fail-closed access control.

An ALB should stop advertising a zone when too few targets are healthy. Which setting fits?

Target group DNS failover thresholds. They mark the zone node unhealthy in DNS when the healthy count or percentage is too low.

An ALB needs to try unhealthy targets before the remaining healthy fleet is overloaded. Which setting fits?

Routing failover thresholds. Below the threshold, the node can send traffic to every available target, including unhealthy ones.

An NLB routes UDP traffic to a service. How should the team make its health check detect UDP service failure?

Use a TCP, HTTP or HTTPS health check endpoint that reports the UDP service's availability.

ALB targets are unhealthy although the app answers the health check path with a 302 redirect. Why?

The default success code is 200; add 302 to the success codes or point the check at a path that returns 200.

What are the default cross-zone balancing settings for ALB, NLB, and GWLB?

ALB always enables it at the load balancer and target groups inherit it unless overridden. NLB and GWLB disable it by default.

An ALB target group disables cross-zone balancing and an enabled zone has no targets. What happens to requests entering that zone?

They receive HTTP 503 errors. Keep capacity in every participating zone or enable cross-zone balancing. Target stickiness is also unsupported with cross-zone disabled.

An NLB has uneven target counts across zones and cross-zone balancing is off. Why are some targets busier?

Each node sends only to its own zone. Equal traffic to nodes can become unequal traffic per target when their target counts differ.

Turning on cross-zone load balancing adds data transfer charges for which load balancer: ALB or NLB?

NLB. Traffic it sends across Availability Zones is billed as regional data transfer; ALB always balances across zones at no such charge.

How can an ALB target finish active requests before it is removed during scale-in?

Use the target group deregistration delay, which defaults to 300 seconds. New requests stop while active work drains; closing connections early can cause 500-level errors.

New ALB targets become overloaded as soon as they pass health checks. Which setting can ramp their traffic?

Slow start. It increases their request share linearly over 30 to 900 seconds and requires a healthy target outside slow start. It cannot use least outstanding requests or weighted random.

Does ALB stickiness make instance-local application sessions survive target failure?

No. ALB chooses another target when the original becomes unhealthy or is deregistered. Keep session state in a shared store such as DynamoDB or ElastiCache so it is independent of the failed instance.

Which ALB target group defaults control draining, warm-up, and session affinity?

Deregistration delay is 300 seconds. Slow start is disabled with value 0. Sticky sessions are disabled.

An ALB rule sends 10 percent of requests to a new target group for a short test, and target group stickiness is enabled with a long duration. What happens to clients first routed to the new group?

They keep returning to it for the stickiness duration because the AWSALBTG cookie pins them, so the test reaches more traffic over time than the weight suggests.

A Network Load Balancer uses sticky sessions, and many users sit behind one corporate NAT device. Why does one target receive most of their traffic?

NLB stickiness follows the source IP address, and all those users share the NAT address. ALB stickiness uses cookies instead.

An ALB returns 5XX responses after a deployment. How can the team identify their origin?

Compare Sum for HTTPCode_ELB_5XX_Count and HTTPCode_Target_5XX_Count. The first counts ALB-generated errors; the second counts target-generated errors. Use access logs and connection metrics to narrow the cause.

An ALB incident requires the client address, request path, latency, and target response for individual requests. What should the team enable?

ALB access logs to an S3 bucket. They provide request details that aggregate metrics do not.

A web server behind an ALB logs the load balancer address instead of client addresses. Which request header helps?

X-Forwarded-For. ALB appends the client address by default; trust only entries added by secured network systems.

An Application Load Balancer must authenticate users before forwarding requests to an application. What can the team configure?

Configure authentication on an HTTPS listener using an OIDC identity provider or an Amazon Cognito user pool.

An ALB authenticate-oidc action fails to save on an HTTP listener on port 80. Why?

User authentication actions are supported only on HTTPS listeners.

One Application Load Balancer must serve three websites with different domain names and TLS certificates on port 443. How?

Add all three certificates to the HTTPS listener's certificate list; the ALB picks the right one with SNI.

Can an ALB target group combine disabled cross-zone balancing with sticky sessions or Lambda targets?

No. Neither target stickiness nor Lambda targets is supported with cross-zone balancing disabled.

A team enables ALB slow start before registering the first batch into an empty target group. Will that batch ramp traffic?

No. The first batch registered together in an empty target group does not enter slow start. A new target needs another healthy target outside slow start.

An ALB target group uses least outstanding requests, but new targets need slow start. What must change?

Use a compatible algorithm such as the default round robin. Slow start cannot run with least outstanding requests or weighted random.

An Application Load Balancer must invoke an AWS Lambda function registered through the CLI. What permission is required?

Grant the ELB service principal lambda:InvokeFunction in the function resource policy, restricted to the target group and account.

A team wants an NLB with a QUIC listener and an attached security group. Is that supported?

No. QUIC and TCP_QUIC listeners require an IPv4 NLB without security groups and cannot coexist with UDP or TCP_UDP listeners.

Can an NLB listener rule match a specific client CIDR range like an ALB source-ip condition?

No. NLB listener rules match the source IP address type, IPv4 or IPv6, on a dualstack NLB.

What are the default ALB health check timings and failure thresholds for instance or IP targets?

30-second interval, 5-second timeout, two consecutive failures to become unhealthy, and five consecutive successes to recover. Initial registration needs one successful check.

Does deregistering an ALB target increase UnHealthyHostCount?

No. It reduces HealthyHostCount without increasing UnHealthyHostCount.

An Application Load Balancer health check fails against a web server that responds only to its public domain name. What should the team check?

Configure a virtual host or default response for the health check Host header, which uses the target private IP and a nondefault health check port.

An NLB target supports only TLS 1.3 and fails HTTPS health checks. What must change?

Enable an earlier TLS version such as TLS 1.2 on the target for the health checks.

An Application Load Balancer returns 5xx errors. Which CloudWatch metric counts errors generated by the load balancer itself?

Use HTTPCode_ELB_5XX_Count with the Sum statistic. It excludes responses generated by targets.

An Application Load Balancer reports target connection errors. Do failed health check connections contribute to TargetConnectionErrorCount?

No. TargetConnectionErrorCount excludes failed health check connections.

Which ALB metric measures time until a target begins sending response headers?

TargetResponseTime, measured in seconds after the request leaves ALB.

An Application Load Balancer must deliver access logs to an Amazon S3 bucket in another account. What bucket configuration is required?

Use a bucket in the same Region with SSE-S3 and allow the ELB log delivery principal s3:PutObject on the account-specific log path.

An operator needs request paths and target response codes to investigate Application Load Balancer errors. What must be enabled?

Enable ALB access logs and specify an S3 bucket. Logging is disabled by default.

After an Amazon Application Recovery Controller zonal shift, existing Application Load Balancer clients keep using connections to the impaired zone. What can reduce this delay?

Set a lower HTTP client keepalive duration for new connections. Existing connections retain the value assigned when they connected.

You finished every topic of DOP-C02!

Your badge turned gold. Next step: book the exam on AWS. Once you pass, add yourself to Who passed.

Share

Share that you finished this certification

I finished every topic of AWS Certified DevOps Engineer - Professional (DOP-C02) on Easy Review. Come study too!