Cloud Load Balancing is a fully distributed, software-defined, managed service for all your traffic. It is not an instance or device based solution, so you won’t be locked into physical load balancing infrastructure or face the HA, scale and management challenges inherent in instance based LBs. Cloud Load Balancing features include:
- HTTP(S) Load Balancing: HTTP(S) load balancing can balance HTTP and HTTPS traffic across multiple backend instances, across multiple regions.
- Network TCP/UDP Load Balancing: load balance external traffic.
- Internal TCP/UDP Load Balancing: load balance internal traffic.
- Seamless Autoscaling: Autoscaling helps your applications gracefully handle increases in traffic and reduces cost when the need for resources is lower.
- Cloud CDN Integration: Enabling Cloud CDN for HTTP(S) Load Balancing for optimizing application delivery for your users.
- Stackdriver Logging: Stackdriver Logging for load balancing logs all the load balancing requests sent to your load balancer.
You can learn more about Cloud Load Balancing in the official documentation.
GCP uses non-standard vocabulary for load balancing concepts. In case you're unfamiliar with load balancing on GCP, here's a short guide:
- Global forwarding rules route traffic by IP address, port, and protocol to a load balancing configuration consisting of a target proxy, URL map, and one or more backend services.
- Target proxies terminate HTTP(S) connections from clients. One or more global forwarding rules direct traffic to the target proxy, and the target proxy consults the URL map to determine how to route traffic to backends.
- URL maps define matching patterns for URL-based routing of requests to the appropriate backend services. A default service is defined to handle any requests that do not match a specified host rule or path matching rule.
- Backends are resources to which a GCP load balancer distributes traffic. These include backend services, such as instance groups or backend buckets.
You can optionally configure a custom domain with input variables create_dns_entries
and custom_domain_names
.
This will create an A records for each domain provided in custom_domain_names
pointing to the Load Balancer's public IP address. Note that you will also have to provide a managed zone name with dns_managed_zone_name
variable.
You can enable SSL with the input variable enable_ssl
.
To use HTTPS or SSL load balancing, you must associate at least one SSL certificate with the load balancer's target proxy using the ssl_certificates
input variable. You can configure the target proxy with up to ten SSL certificates.
For HTTP(S) Proxy Load Balancing, Google encrypts traffic between the load balancer and backend instances. SSL certificate resources are not required on individual VM instances.
To use self-managed SSL certificates, you must have an existing SSL certificate resource. You can pass the certificate self links using the ssl_certificates
input variable.
NOTE: This is part of Alpha release of GCP HTTP(S) Load Balancing Logging. For full details, see the official documentation.
If you intend to use the load balancer for serving a static site using a Google Cloud Storage bucket backend, you can optionally configure access logging for your bucket.
Each HTTP(S) request is logged temporarily via Stackdriver Logging. During the Alpha testing phase, logging is automatic and does not need to be enabled. To view logs, go to the Logs Viewer.
HTTP(S) Load Balancing log entries contain information useful for monitoring and debugging your HTTP(S) traffic. Log entries contain the following types of information:
- General information shown in most GCP logs, such as severity, project ID, project number, timestamp, and so on.
- HttpRequest log fields. However,
HttpRequest.protocol
andHttpRequest.latency
are not populated for HTTP(S) Load Balancing Stackdriver logs. - a
statusDetails
field inside thestructPayload
. This field holds a string that explains why the load balancer returned the HTTP status that it did.
HTTP(S) Load Balancing exports monitoring data to Stackdriver.
Monitoring metrics can be used for the following purposes:
- Evaluate a load balancer's configuration, usage, and performance
- Troubleshoot problems
- Improve resource utilization and user experience
In addition to the predefined dashboards in Stackdriver, you can create custom dashboards, set up alerts, and query the metrics through the Stackdriver monitoring API.