ezgh lb listeners create <load-balancer> --protocol tcp|tls|http|https --port p --target-group <tgp_…> [--certificate <crt_…>] [--allowed-source-cidr c…] [--idle-timeout s] [flags]Add a listener: a port on the load balancer that sends connections to a target group. A target group serves one load balancer, in its VPC. A tls or https listener needs --certificate, an issued certificate, and ends TLS with TLS 1.2 or 1.3; --additional-certificate adds more, served to clients asking by SNI for a name they cover. --allowed-source-cidr limits who may connect; without it, anyone can.
An http or https listener routes each request: its rules (--rules-file) are checked in order, and its default action takes what none matches: forward to a target group (--target-group, or --forward to split by weight), redirect to HTTPS (--redirect-https) or answer with a status code (--fixed-response). It forwards to http target groups. A rule’s forward can also change the request’s headers on the way in and the response’s on the way out: requestHeaderModifier and responseHeaderModifier, each removing, setting and adding headers.
Part of ezgh lb listeners.
Examples
ezgh lb listeners create lbr_4k2m9x0a7qpe --protocol tls --port 443 --target-group tgp_7t3n1v8c2wzd --certificate crt_8s4f2k9d1mzq
ezgh lb listeners create lbr_4k2m9x0a7qpe --protocol tcp --port 5432 --target-group tgp_7t3n1v8c2wzd --allowed-source-cidr 203.0.113.0/24
ezgh lb listeners create lbr_4k2m9x0a7qpe --protocol https --port 443 --forward tgp_7t3n1v8c2wzd=90 --forward tgp_2b6d8f0h4jkm=10 --certificate crt_8s4f2k9d1mzq
ezgh lb listeners create lbr_4k2m9x0a7qpe --protocol http --port 80 --redirect-httpsFlags
| Flag | Type | Default | Description |
|---|---|---|---|
--additional-certificate |
string, repeatable | another certificate (crt_…) for a tls or https listener, served to clients asking by SNI for a name it covers; repeat for more, at most 24 | |
--allowed-source-cidr |
string, repeatable | an IPv4 or IPv6 CIDR that may connect; repeat for more, at most 20 (default everyone, on each family the load balancer answers on) | |
--certificate |
string | a tls or https listener’s certificate (crt_…) | |
--fixed-response |
int | an http listener’s default action: answer with this status code, 200 to 599 | |
--forward |
string, repeatable | an http listener’s default action: forward to a target group (tgp_…); repeat with weights, tgp_…=90, to split | |
--idle-timeout |
int | seconds a connection may sit idle: tcp and tls 60 to 6000 (default 350), http and https 1 to 4000 (default 60) | |
--port |
int | the port it listens on, 1 to 65535 | |
--protocol |
string | tcp, tls, http or https | |
--redirect-https |
boolean | an http listener’s default action: redirect to HTTPS on port 443, keeping the host, path and query (301) | |
--rules-file |
string | an http listener’s rules, in order: rules as JSON (a list, or a listener with rules), - for stdin | |
--target-group |
string | where it sends connections (tgp_…) |
This command also takes the global flags.