Skip to main content

LoadBalancer

不同Load Balancer沒有容易的方法互相轉換

  • CLB: Classic Load Balancer (Elastic Load Balancer)
    • Disabled by default
      • Enabled之後,跨AZ的data不會被收費
    • 最便宜
    • ELB看待自己monitor的service為兩種狀態: InService, OutofService
  • 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
CLBALBNLB
OSI LayerL7 or L4 (TCP)L7L4 (TCP, UDP)
SSL TerminationOnly 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 protocolsHTTP, HTTPS, TCPHTTP, HTTP2, HTTPS, WebSocketTCP, UDP,TLS, WebSockets
Support Internal protocolsHTTP, TCPHTTP, HTTP2, WebSocket
Target GroupEC2EC2 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 CheckOn target group level
Route RuleNoneURL Path
Hostname
Query String
Headers
Latency?~400ms~100ms
Cross AZ Load BalancingCross 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)SupportSupportNot Support (Only work on L4)
One static IP per AZ
Support Elastic IP