TLS on load balancers and CloudFront
SSL offload, re-encryption and passthrough on ELB, plus CloudFront viewer and origin protocol policies, custom certificates and field-level encryption.
Exam tasks: 5.1.1 (require encryption: load balancer security policies, TLS), 5.1.2 (secure private access)
The decision: on every hop between a client and your data, where is TLS terminated, who holds the private key, which protocol versions are allowed, and how do you prove nothing travels in cleartext?
TLS can terminate at the edge, at the load balancer, or on the instance. Choose by whether a middlebox may see plaintext.
Which one to use
| Pattern | Listener | Certificate lives on | Load balancer sees plaintext | Use when |
|---|---|---|---|---|
| Terminate | ALB HTTPS or NLB TLS, HTTP/TCP to targets | Load balancer (ACM) | Yes | Internal hop is trusted, and you want offload |
| Re-encrypt | ALB HTTPS to HTTPS targets, NLB TLS to TLS targets | LB and targets | Yes, briefly | Compliance needs encryption on every hop, and you still want WAF or routing |
| Passthrough | NLB TCP 443 to targets | Targets only | No | Key must never leave your servers, or the target does its own mTLS |
- ALB handles HTTP and HTTPS. For other TLS protocols or for passthrough, use an NLB, which also supports TLS listeners that terminate.
- An ALB doesn't validate the certificate on HTTPS targets, so self-signed or Private CA certificates on the targets are fine.
- With passthrough, the load balancer can't add
X-Forwarded-Foror run AWS WAF, and ACM certificates can't be installed on the instances (unless you use an exportable ACM certificate or AWS Private CA).
Exam signal
"Load balancer must not see plaintext" means TCP/TLS passthrough on an NLB with the certificate on the instances. "Protect a single form field from every tier except the order service" means CloudFront field-level encryption.
Load balancer security policies
A security policy fixes the TLS versions and cipher suites the load balancer negotiates with clients.
| Policy family | Allows | Pick it for |
|---|---|---|
ELBSecurityPolicy-TLS13-1-2-Res-PQ-2025-09 | TLS 1.3 and 1.2, forward-secret ciphers, hybrid post-quantum key exchange | Console default and the AWS recommendation |
ELBSecurityPolicy-TLS13-1-2-2021-06 | TLS 1.3 and 1.2 | Broad compatibility without legacy protocols |
ELBSecurityPolicy-TLS13-1-3-2021-06 (and -PQ- variants) | TLS 1.3 only | "Only TLS 1.3" requirements |
...-FIPS-... | FIPS-validated cryptographic modules | FedRAMP and FIPS 140 requirements |
...-RFC9151-... | CNSA 1.0 suites | US national security workloads |
ELBSecurityPolicy-2016-08 | Down to TLS 1.0 | Default for CLI, CloudFormation and CDK, so always set a policy explicitly |
- Forward secrecy (FS/PFS): every TLS 1.3 policy provides it, and so do TLS 1.2 policies limited to ECDHE ciphers. A stolen private key then can't decrypt previously recorded sessions.
- ALB doesn't support custom policies; pick a predefined one. The policy for the ALB-to-target leg is derived from the listener policy, not chosen separately.
- Restrict which policies teams may choose with the
elasticloadbalancing:SecurityPolicycondition key in an SCP or IAM policy. - Enable connection logs on the ALB to see the negotiated TLS version and cipher per connection before you tighten a policy.
- An HTTPS listener needs at least one server certificate and a security policy.
- Security Hub control ELB.17 checks that HTTPS and TLS listeners use a recommended policy.
The default you didn't choose
A listener created with CloudFormation or the CLI without SslPolicy gets ELBSecurityPolicy-2016-08, which
still allows TLS 1.0 and 1.1. When a scan finds "TLS 1.0 enabled on the load balancer" in an IaC-built stack, the
fix is to set a TLS 1.2+ policy on the listener, not to rotate the certificate.
SNI and multiple certificates
- ALB and NLB TLS listeners accept multiple certificates, and choose one per connection by the SNI host name
the client sends. One listener can serve
shop.example.comandapi.example.org. - CloudFront serves custom certificates with SNI by default. A dedicated-IP option exists only for very old clients that don't send SNI.
- The default certificate is used only when the client sends no SNI name or nothing matches.
- ACM certificates on a load balancer renew automatically. Imported certificates do not.
Mutual TLS
| Where | How it works |
|---|---|
| ALB, verify mode | Upload a CA bundle as a trust store (from S3), optionally with CRLs. The ALB rejects clients without a valid certificate and passes certificate details to targets in headers |
| ALB, passthrough mode | The ALB forwards the client's certificate chain in the X-Amzn-Mtls-Clientcert header, and your application verifies it |
| API Gateway | Custom domain with a truststore in S3. Disable the default execute-api endpoint so clients can't skip mTLS |
| NLB TCP passthrough | The target terminates TLS and verifies client certificates itself |
Private CA is the usual issuer for client certificates on devices, partner systems and internal services.
CloudFront
| Setting | Options | Secure choice |
|---|---|---|
| Viewer protocol policy (per behaviour) | HTTP and HTTPS, Redirect HTTP to HTTPS, HTTPS only | Redirect or HTTPS only |
| Viewer security policy | Minimum TLS version for viewers | TLSv1.2_2021 or newer |
| Origin protocol policy (custom origins) | HTTP only, HTTPS only, Match viewer | HTTPS only |
| Origin SSL protocols | TLS versions to the origin | TLS 1.2 |
| Custom domain certificate | Certificate must cover the alternate domain name. Request it in ACM in us-east-1 or import it | Valid, matching name |
| Geo restriction | Allow list or block list of countries | Not a TLS control |
- The origin's certificate must be valid and match the origin domain name (or the Host header you forward). CloudFront won't connect to an origin with a self-signed certificate.
- An S3 website endpoint only speaks HTTP. For HTTPS end to end, use the S3 REST endpoint with origin access control (OAC), which also works with SSE-KMS buckets.
- Field-level encryption encrypts chosen POST form fields (up to 10) at the edge with an RSA 2048 public key you upload, using RSA-OAEP SHA-256. Only the component holding the private key, deep in your stack, can read them, so intermediate services and logs only see ciphertext.
Exam trap
Choosing "match viewer" does not secure the origin leg when viewers use HTTP. And an ALB cannot do passthrough of non-HTTP protocols.
Forcing TLS on AWS APIs and data stores
{
"Sid": "DenyWithoutTls",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": ["arn:aws:s3:::orders-archive-7731", "arn:aws:s3:::orders-archive-7731/*"],
"Condition": { "Bool": { "aws:SecureTransport": "false" } }
}- Put the same deny on SQS queue policies, SNS topic policies and EFS file system policies.
- Use
s3:TlsVersion(numeric condition) to require a minimum version, for example a deny whens3:TlsVersionisNumericLessThan1.3 for a TLS 1.3-only bucket. - AWS service API endpoints already require TLS 1.2 or later.
- Hybrid links: Site-to-Site VPN (IPsec) or MACsec on dedicated Direct Connect connections. See VPN options and Direct Connect encryption.
Scenarios
Re-encryption keeps both hops encrypted and still lets the ALB run WAF and path routing. An NLB TCP passthrough is encrypted end to end but can't do WAF or path routing. HTTP to targets leaves the inner hop in cleartext, even in private subnets. An NLB TLS listener with TCP targets also sends plaintext to the instances.
The listener picked up the CLI and CloudFormation default policy, which allows TLS 1.0. Setting a TLS 1.2+ policy fixes it in place, and the chosen policy offers only forward-secret ciphers. The certificate doesn't control protocol versions. WAF inspects HTTP requests after the TLS handshake, so it can't block old protocols. Adding CloudFront is far more work and leaves the ALB itself unchanged.
Related
- ACM and Private CA
- Inter-resource encryption in transit
- ALB vs NLB vs GLB security features
- ELB security
Further reading
- Create an HTTPS listener for your Application Load Balancer
- Security policies and secure listener settings
- CloudFront field-level encryption
- CloudFront alternate domain names and HTTPS requirements
- Security policies for your Application Load Balancer
- Mutual authentication with TLS in Application Load Balancer
AWS CloudHSM and KMS comparison
Single-tenant HSM clusters you control, when to pick CloudHSM over KMS, and the custom key stores (CloudHSM and external) that let AWS services use that key material.
ACM and Private CA
Public and private certificates, automatic renewal, 198-day validity, regional CAs and cross-account issuance.