SSL/TLS termination in AWS - Time & Space Complexity
When we use SSL/TLS termination in AWS, we want to know how the time to handle secure connections changes as more users connect.
We ask: How does the work grow when many secure requests come in?
Analyze the time complexity of the following operation sequence.
// Create a load balancer with SSL termination
aws elbv2 create-load-balancer --name my-lb --subnets subnet-123 subnet-456
// Create a listener with SSL certificate
aws elbv2 create-listener --load-balancer-arn arn:aws:lb --protocol HTTPS --port 443 --certificates CertificateArn=arn:aws:acm:cert/123
// Forward requests to target group
aws elbv2 create-target-group --name my-targets --protocol HTTP --port 80 --vpc-id vpc-789
This sequence sets up a load balancer that ends SSL connections and forwards plain HTTP to servers.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Handling each incoming HTTPS connection and decrypting SSL/TLS.
- How many times: Once per client connection request.
Each new secure connection requires the load balancer to perform SSL handshake and decryption work.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 SSL handshakes and decryptions |
| 100 | 100 SSL handshakes and decryptions |
| 1000 | 1000 SSL handshakes and decryptions |
Pattern observation: The work grows directly with the number of connections.
Time Complexity: O(n)
This means the time to handle SSL termination grows linearly with the number of secure connections.
[X] Wrong: "SSL termination time stays the same no matter how many users connect."
[OK] Correct: Each new connection needs its own SSL handshake and decryption, so more users mean more work.
Understanding how SSL termination scales helps you design systems that handle secure traffic smoothly as user numbers grow.
"What if SSL termination was moved from the load balancer to each backend server? How would the time complexity change?"
Practice
Solution
Step 1: Understand SSL/TLS termination role
SSL/TLS termination means the load balancer decrypts HTTPS traffic so backend servers receive plain HTTP.Step 2: Identify where decryption happens
The load balancer handles the SSL certificates and decrypts traffic, simplifying backend server setup.Final Answer:
To decrypt incoming HTTPS traffic before sending it to backend servers -> Option BQuick Check:
SSL/TLS termination = decrypt at load balancer [OK]
- Thinking backend servers handle SSL decryption
- Confusing encryption with decryption location
- Assuming SSL certificates must be on backend servers
Solution
Step 1: Identify correct protocol and port for SSL termination
HTTPS protocol on port 443 is standard for SSL/TLS termination.Step 2: Confirm SSL certificate attachment
SSL certificate must be attached to the HTTPS listener to enable termination.Final Answer:
Listener protocol HTTPS on port 443 with SSL certificate attached -> Option CQuick Check:
HTTPS + port 443 + cert = SSL termination [OK]
- Using HTTP protocol with SSL certificate
- Using wrong port for HTTPS
- Not attaching SSL certificate to listener
Listener: HTTPS on port 443 with SSL certificateWhat happens if a client sends an HTTP request to port 80?
Solution
Step 1: Check listener configuration for port 80
No listener is defined on port 80, so the load balancer does not accept HTTP requests.Step 2: Understand behavior without HTTP listener
Without an HTTP listener, requests to port 80 fail with connection errors.Final Answer:
The request is rejected with a connection error -> Option DQuick Check:
No HTTP listener = connection error on port 80 [OK]
- Assuming automatic HTTP to HTTPS redirect without listener
- Thinking HTTP requests are accepted without encryption
- Confusing backend server behavior with load balancer
Solution
Step 1: Verify SSL certificate validity
SSL errors often occur if the certificate is expired or not trusted by client browsers.Step 2: Check listener and backend setup
Listener is HTTPS with certificate attached, so listener config is correct; backend HTTPS support is optional after termination.Final Answer:
The SSL certificate is expired or not trusted by clients -> Option AQuick Check:
SSL errors usually mean bad or expired cert [OK]
- Assuming backend HTTPS affects client SSL errors
- Confusing listener protocol with certificate validity
- Ignoring certificate expiration or trust chain
Solution
Step 1: Understand how to redirect HTTP to HTTPS at load balancer
Creating an HTTP listener on port 80 that redirects to HTTPS ensures all HTTP requests become secure.Step 2: Evaluate other options
Disabling HTTP listener blocks HTTP requests; backend redirects add latency and complexity; attaching certs only to backend does not redirect.Final Answer:
Create an HTTP listener on port 80 that redirects all requests to HTTPS on port 443 -> Option AQuick Check:
HTTP listener with redirect = secure all traffic [OK]
- Disabling HTTP listener without redirect
- Relying on backend servers for redirects
- Not attaching SSL cert to load balancer listener
Ready to prove it?
Pass the test and this pattern moves unknown
