Unit 3.3: Load Balancing - Layer 7 (Application)
Introduction
FinCorp's customer portal and its partner API share one public entry point. Requests must be routed by host and path, TLS must end at a controlled point, and only healthy portal servers may receive traffic. That is a Layer 7 problem, and on IONOS CLOUD it is solved by the ALB, composed with an ingress controller where Kubernetes runs behind it.
This unit designs the ALB as the public edge of the layered architecture from Unit 1.2. It covers what each component decides, where TLS is terminated and with which certificate, what the per-rule price means for the rule design, and why filtering moves to the targets and the application. It ends by building the edge in the DCD.
1. When Layer 7 Earns Its Place
1.1 The Selection Rule
The ALB operates at Layer 7 and the Managed Network Load Balancer (NLB) at Layer 4. If your balancing logic needs to process HTTP requests and their attributes, use the ALB. If routing performance is critical, limit the logic to Layer 4 and route TCP traffic with the NLB. The NLB distributes any TCP-based traffic, including HTTP and HTTPS, but its rules and health checks are strictly TCP-based, so routing decisions based on the URL are not possible there (Unit 3.4).
The ALB's decision inputs are the request itself. Forwarding conditions can match the HTTP header, path, query string, method, host, cookie or source IP. Each rule then forwards to a target group, redirects to another URL with a chosen status code, or returns a static response. The ALB also supports WebSocket, and gRPC through the HTTP2 protocol version of a target group. It identifies the server name (SNI), so multiple secure websites can share one public IP with individual certificates.
1.2 Where the ALB Sits
An ALB is public or private. A public listener accepts client connections from the internet and requires a reserved public IP address; a private listener sits on a private network for east-west traffic and gets its primary address automatically. Each ALB has at least one listener and supports up to 10. A contract can hold five ALBs, a limit IONOS CLOUD Support can adjust.
Two behaviours shape the tier behind it. The ALB does not support Source NAT (SNAT), so targets cannot initiate connections through it; outbound traffic needs the NAT Gateway (Unit 3.6). And its backend presents a private address, by default x.x.x.225 in the target LAN, as the source of client traffic, which is the source your target security groups allow (Unit 3.2). The client's address can be preserved and forwarded in headers, or passed through the Proxy Protocol (v1, v2 or v2ssl) to backends such as Apache, NGINX or an ingress controller inside Kubernetes that have it enabled.
IONOS CLOUD maintains the ALB in a weekly window every Monday between 02:00 and 04:00 local time of its data center, with a service interruption of up to 5 seconds.
2. The Three Components
2.1 Listener and Forwarding Rule
Each ALB requires at least one listener, a forwarding rule and a target group. The listener checks for connection requests on the protocol and port you configure, HTTP or HTTPS on a port from 1 to 65535. A forwarding rule binds a listener IP and port to a set of HTTP rules and carries the client timeout, by default 50000 milliseconds: the idle time after which the ALB closes a client connection that sends nothing further.
Rule evaluation is hierarchical. Each rule consists of a priority, one or more actions and one or more conditions, and a condition can be negated with not. There must be a default rule action: if none of the other conditions match, the default action runs, and the default rule is evaluated last. Design the rule list from specific to general, with the catch-all forward to the main portal as the default.
2.2 Target Group and Health Checks
A target group holds registered targets, each defined by IP address, port and weight. Any object with an IP address in the VDC can be a target, including another load balancer, and the same target can be registered in several groups. The group sets the algorithm, Round Robin, Least connections, Random or Source IP (the same client IP always reaches the same target), and the protocol version, HTTP1 by default or HTTP2 for gRPC. A target's weight, up to 256, sets its share of traffic; the default is 1.
Health checks are properties of the target group, performed by the ALB once the group is bound to a forwarding rule. A TCP check opens a connection to the backend port; an HTTP check sends a request to a path (default /) and matches the status code or the response body, with regular expressions and negation. Three parameters are yours: Check Interval (default 2000 ms), Check Timeout and Retries (default 3).
Checks are synchronous: the next starts only after the previous one completes. For an HTTP check the maximum check duration is twice the check timeout, one timeout to open the TCP connection and one to receive the response, so detection time grows with timeout, interval and retries together. Two target options matter operationally: Health Check Enabled removes a failing target from rotation automatically, and Maintenance Enabled takes a target out of balanced traffic while you work on it. Do not configure an HTTP health check on a group that carries gRPC or WebSocket traffic.
2.3 TLS Termination and Certificates
The ALB terminates TLS. Certificates come from the Certificate Manager, and the certificate type matters: an Auto certificate (issued and renewed through ACME) can be used for CDN, while the ALB uses an imported certificate. You upload the certificate, its chain and the private key in PEM format.
The ALB validates the upload strictly. It requires exactly one leaf (non-CA) certificate, optionally with intermediate or root certificates in the same file; a single RSA private key in PKCS#1 or PKCS#8 format that matches the leaf; and valid PEM-encoded X.509 for any CA certificates. EC or ECDSA keys, multiple leaf certificates and mismatched pairs are rejected. Because the ALB terminates TLS, the backend leg can be plain HTTP inside the private LAN; if policy requires the certificate to stay on the backend with end-to-end encryption, use a Layer 4 path (Unit 3.4).
The operational consequence is renewal. Automatic renewal is a property of Auto certificates. After an imported certificate is created, only its name can be edited, and its private key is write-only. Renewal is therefore a planned change in your runbook: import the new certificate as a new object, associate it with the forwarding rule, and remove the old one.
3. Cost, Filtering and the API-Gateway Pattern
3.1 Per-Rule Billing
The ALB is billed per forwarding rule:
| Price per hour per rule | Price group | |
|---|---|---|
| The first 5 forwarding rules | 0,02 € | PG J |
| Each additional forwarding rule | 0,01 € | PG J |
| Processing fee for incoming and outgoing data | no charge |
Please note: A minimum charge equivalent to one rule applies, even if none are configured.
As shown above, the cost driver is the number of forwarding rules, not traffic. HTTP rules and their conditions live inside a forwarding rule, so a lean design uses one forwarding rule per listener IP and port and expresses the routing as HTTP rules within it. An HTTP-to-HTTPS redirect on port 80 is a second forwarding rule and is worth its price; one forwarding rule per microservice usually is not.
3.2 Filtering Belongs on the Targets
The ALB is not a VM or NIC, so no Network Security Group (NSG) attaches to it, and the targets see the ALB's backend address rather than the client. Client filtering therefore has three possible places, and each has a cost:
| Option | Advantages | Disadvantages | Best for |
|---|---|---|---|
| NSG on targets allowing only the ALB backend | Enforced at the network layer; no client can bypass the ALB | Cannot distinguish clients | Every ALB target tier (baseline) |
| ALB condition on Source IP with a static or redirect response | Early, per request | A routing decision, not a network filter; each rule set must be maintained per listener | Coarse partner allow lists on a dedicated host or path |
| Application check on the forwarded client address | Fine-grained, auditable | Implemented and tested by your team | Per-user or per-partner policy |
Attack traffic is handled by a different layer. DDoS Protect covers Layer 3 and Layer 4, always on by default; it does not cover Layer 7. For Layer 7 DDoS protection and a web application firewall in front of a public site, the CDN is the platform's option.
3.3 The API-Gateway Substitution
The platform composes an API gateway rather than selling one (Unit 1.3). At the edge, ALB host and path rules route coarse prefixes, such as api.fincorp.example or /api/, to the right target group and terminate TLS. Inside a Managed Kubernetes cluster, an ingress controller carries the fine-grained routing, because a Service of type LoadBalancer assigns a static IP to one node rather than provisioning a managed balancer (Unit 6.2). Proxy Protocol on the target lets the ingress controller see the client address. Authentication, quotas and request transformation are application or ingress features that you choose and operate.
DCD Implementation Walkthrough
You will build FinCorp's public edge in fc-prod-fra-core: an ALB on fc-edge with an HTTPS listener, the portal target group with an HTTP health check, and a path rule that sends /api/ to the partner API servers. This is the Layer 7 tier of the layered design.
Prerequisites: a reserved public IPv4 address from the fc-prod-fra-edge block (Unit 3.1); the portal and API servers on fc-app with fc-nsg-app allowing the ALB backend address (Unit 3.2); an imported certificate in Menu > Security > Certificate Manager (Create Certificate > Import a certificate, with certificate, chain and private key in PEM format).
Build goal: Build a public Layer 7 balancer with an HTTPS listener, target group, path rule, and health check.
Steps (in the Data Center Designer):
- Go to Menu > Network Services > Target Groups and select Create. Enter Name
fc-tg-portal, choose an Algorithm (for example Least connections), keep ProtocolHTTPand Protocol VersionHTTP1. - In the Connection tab, set Check Timeout, keep Check Interval
2000and Retries3unless your detection target says otherwise. Select Add Health Check and enter the Path of a health endpoint, a Method, and Match Type Status Code. - In the Targets tab, select Add and enter the IP and Port of
fc-app-01, Weight1, Proxy Protocolnone(or a version your servers have enabled), and select Health Check Enabled. Addfc-app-02the same way, then select Create. - Create a second target group
fc-tg-apifor the partner API servers in the same way. - Open
fc-prod-fra-core. Drag a Load Balancer of type application into the Workspace. Connect the northern interface to Internet Access and the southern interface to thefc-appLAN of the target servers. - In Settings, enter the Name
fc-alb-edgeand select the reserved address as Primary IPv4. Optionally configure a Flowlog. - In the Forwarding rules tab, select Add forwarding rule: enter a Name, choose the HTTPS protocol, select the Listener IP and Listener port
443, and review the Client timeout. Select Add Certificate and choose the imported certificate. - Select Add HTTP Rule and create a Forward rule to
fc-tg-api. Select Add Condition, choose Type Path and a condition that matches the/api/prefix, and select Add Condition. Then add a Forward rule tofc-tg-portalfor all remaining requests, so that the portal is the default action. Select OK. - Check the Private IPs tab: the backend address defaults to
.225onfc-app. It must match the source infc-nsg-app. - Select PROVISION CHANGES and then Provision Now. Provisioning cannot be cancelled, but the ALB can be modified afterwards.
Common mistakes:
- Building the ALB before reserving the public IP. A public listener needs a reserved address in the VDC's region.
- Uploading an ECDSA certificate, a chain without the leaf, or a file with two leaf certificates. The ALB accepts one RSA leaf.
- Selecting an Auto certificate for the ALB. Auto certificates serve CDN; the ALB uses imported certificates, which you renew yourself.
- Creating one forwarding rule per service. Each forwarding rule is billed; route with HTTP rules inside one forwarding rule.
- Configuring an HTTP health check on a gRPC or WebSocket target group.
- Expecting targets to initiate outbound connections through the ALB. It does not support SNAT.
Summary
The ALB earns its place wherever routing depends on HTTP attributes or TLS must end at a managed edge. Its design is three components: listeners, forwarding rules evaluated by priority with a default last, and target groups that own the algorithm and health checks. Certificates are imported, RSA and single-leaf, and their renewal is your runbook. Billing per forwarding rule rewards consolidation, and because the ALB takes no NSG and presents its own backend address, filtering lives on the targets and in the application.
Key Points:
- Use the ALB when routing needs HTTP attributes; use the NLB when Layer 4 is enough or performance is critical.
- Each ALB needs a listener, a forwarding rule and a target group; up to 10 listeners per ALB, five ALBs per contract by default.
- The default rule is evaluated last; health checks are synchronous, and an HTTP check can take up to twice the check timeout.
- The ALB uses imported PEM certificates with exactly one RSA leaf; Auto certificates serve CDN.
- Forwarding rules cost 0,02 € per hour for the first five and 0,01 € for each additional one.
- Targets see the ALB backend address, by default
.225; allow it in the target NSG and filter clients in the application.
Important Terminology:
- Forwarding rule: the billed ALB object binding a listener IP and port to a prioritised list of HTTP rules.
- Target group: a reusable set of targets with its algorithm, protocol version and health check.