LoadBalancer
不同Load Balancer沒有容易的方法互相轉換
- CLB: Classic Load Balancer (Elastic Load Balancer)
- Disabled by default
- Enabled之後,跨AZ的data不會被收費
- 最便宜
- ELB看待自己monitor的service為兩種狀態: InService, OutofService
- Disabled by default
- ALB: Application Load Balancers
- 跨AZ的data不會被收費
- Work在Layer 7
- 可以做很細節的routing
- 支援HTTP, HTTPS, HTTP2, Websocket
- Route Rule
- Based on path
- Based on host name
- Based on Query String, Headers
- Port Mapping (For ECS)
- NLB: Network Load Balancer
- 跨AZ要算錢
- Work在Layer 4
- 高效能
- 只要提到要cost saving on NLB,答案通常是CLB
- 如果要知道end-user的IP: 看X-Forwarded-For Header
CLB | ALB | NLB | |
---|---|---|---|
OSI Layer | L7 or L4 (TCP) | L7 | L4 (TCP, UDP) |
SSL Termination | Only 1 SSL Cert: Multi domain need to renew entire cert TCP -> TCP Passthrough: The only way to use 2-way SSL auth | Support multi listener (cert) Support SNI - Server Name Indication | - |
Support Listening protocols | HTTP, HTTPS, TCP | HTTP, HTTP2, HTTPS, WebSocket | TCP, UDP,TLS, WebSockets |
Support Internal protocols | HTTP, TCP | HTTP, HTTP2, WebSocket | |
Target Group | EC2 | EC2 Instance - HTTP ECS Task - HTTP Lambda function - HTTP into JSON Private IP Address - Peered VPC, OnPremise | EC2 Instance - TCP ECS Task - TCP IP Address - Private IP only Even outside VPC |
Health Check | On target group level | ||
Route Rule | None | URL Path Hostname Query String Headers | |
Latency | ? | ~400ms | ~100ms |
Cross AZ Load Balancing | Cross AZ default disabled No charges for inter AZ if enabled | Cross AZ always on No charges for inter AZ | Cross AZ default disabled Charge for inter AZ if enabled |
Stickiness (L7) | Support | Support | Not Support (Only work on L4) |
One static IP per AZ Support Elastic IP |