Table: gcp_compute_backend_service - Query Google Cloud Compute Engine Backend Services using SQL
Google Cloud Compute Engine Backend Services are a part of Google Cloud's Load Balancing feature, providing a scalable, reliable, and efficient way to distribute traffic across various instances. They manage HTTP(S) Load Balancing by directing traffic to available instances based on the capacity and load of each instance. This service helps in optimizing resource utilization and minimizing latency.
Table Usage Guide
The gcp_compute_backend_service
table provides insights into Google Cloud Compute Engine Backend Services. As a DevOps engineer, you can explore details about these services through this table, including their configurations, statuses, and associated instances. Utilize it to manage and monitor the distribution of traffic across your instances, ensuring optimal resource utilization and performance.
Examples
Backend info of backend service
Determine the areas in which your Google Cloud Compute backend service is balancing its workload, along with identifying the associated network endpoint groups. This can help you manage workload distribution and optimize network performance.
select name, id, b ->> 'balancingMode' as balancing_mode, split_part(b ->> 'group', '/', 10) as network_endpoint_groupsfrom gcp_compute_backend_service, jsonb_array_elements(backends) as b;
Error: The corresponding SQLite query is unavailable.
List of backend services where health check is not configured
Discover the segments that lack health check configurations within the Google Cloud Platform's backend services. This can help in identifying potential vulnerabilities and ensuring optimal performance of the services.
select name, id, self_link, health_checksfrom gcp_compute_backend_servicewhere health_checks is null;
select name, id, self_link, health_checksfrom gcp_compute_backend_servicewhere health_checks is null;
List of backend services where connection draining timeout is less than 300 sec
Determine the areas in which backend services may experience connection issues due to a draining timeout of less than 300 seconds. This can be useful for troubleshooting and optimizing network performance.
select name, id, connection_draining_timeout_secfrom gcp_compute_backend_servicewhere connection_draining_timeout_sec < 300;
select name, id, connection_draining_timeout_secfrom gcp_compute_backend_servicewhere connection_draining_timeout_sec < 300;
List of backend services where logging is not enabled
Discover the segments that have logging disabled in your backend services. This can help in identifying areas where crucial event tracking might be missing, aiding in improving system monitoring and error detection.
select name, id, log_config_enablefrom gcp_compute_backend_servicewhere not log_config_enable;
select name, id, log_config_enablefrom gcp_compute_backend_servicewhere log_config_enable = 0;
Query examples
Control examples
- All Controls > Compute > Ensure external backend service has IAP enabled
- CIS v2.0.0 > 2 Logging and Monitoring > 2.16 Ensure Logging is enabled for HTTP(S) Load Balancer
- CIS v3.0.0 > 2 Logging and Monitoring > 2.16 Ensure Logging is enabled for HTTP(S) Load Balancer
- Ensure Logging is enabled for HTTP(S) Load Balancer
Schema for gcp_compute_backend_service
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
affinity_cookie_ttl_sec | bigint | Specifies the lifetime of the cookies in seconds. Only applicable if the loadBalancingScheme is EXTERNAL, INTERNAL_SELF_MANAGED, or INTERNAL_MANAGED, the protocol is HTTP or HTTPS, and the sessionAffinity is GENERATED_COOKIE, or HTTP_COOKIE. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
backends | jsonb | An list of backends that serve this BackendService. | |
cdn_policy_cache_key_policy | jsonb | Specifies the CacheKeyPolicy for this CdnPolicy. | |
circuit_breakers | jsonb | Settings controlling the volume of connections to a backend service. | |
connection_draining_timeout_sec | bigint | Specifies the amount of time in seconds to allow existing connections to persist while on unhealthy backend VMs. Only applicable if the protocol is not UDP. The valid range is [0, 3600]. | |
creation_timestamp | timestamp with time zone | The creation timestamp of the resource. | |
description | text | A user-specified, human-readable description of the backend service. | |
enable_cdn | boolean | !=, = | Specifies whether the Cloud CDN is enabled for the backend service, or not. |
failover_policy | jsonb | Applicable only to Failover for Internal TCP/UDP Load Balancing. | |
fingerprint | text | An unique system generated string, to reduce conflicts when multiple users change any property of the resource. | |
health_checks | jsonb | A list of URLs to the healthChecks, httpHealthChecks (legacy), or httpsHealthChecks (legacy) resource for health checking this backend service. | |
iap | jsonb | Specifies the configurations for Identity-Aware Proxy on this resource. | |
id | bigint | The unique identifier for the resource. | |
kind | text | The type of the resource. | |
load_balancing_scheme | text | !=, = | Specifies the type of the load balancer. |
locality_lb_policy | text | Specifies the load balancing algorithm used within the scope of the locality. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
location_type | text | Location type where the backend service resides. | |
log_config_enable | boolean | Specifies whether to enable logging for the load balancer traffic served by this backend service, or not. | |
log_config_sample_rate | double precision | Specifies the sampling rate of requests to the load balancer where 1.0 means all logged requests are reported and 0.0 means no logged requests are reported. The default value is 1.0. | |
name | text | = | A friendly name that identifies the resource. |
network | text | The URL of the network to which this backend service belongs. | |
port | bigint | Specifies the TCP port to connect on the backend. The default value is 80. | |
port_name | text | !=, = | A named port on a backend instance group representing the port for communication to the backend VMs in that group. |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
protocol | text | Specifies the protocol that the BackendService uses to communicate with backends. | |
region | text | The URL of the region where the regional backend service resides. This field is not applicable to global backend services. | |
security_policy | text | The resource URL for the security policy associated with this backend service. | |
security_settings | jsonb | Specifies the security policy that applies to this backend service. | |
self_link | text | The server-defined URL for the resource. | |
session_affinity | text | !=, = | Specifies the type of session affinity to use. The default is NONE. Session affinity is not applicable if the protocol is UDP. |
signed_url_cache_max_age_sec | bigint | Specifies the maximum number of seconds the response to a signed URL request will be considered fresh. | |
signed_url_key_names | jsonb | A list of names of the keys for signing request URLs. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
timeout_sec | bigint | Specifies the backend service timeout. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- gcp
You can pass the configuration to the command with the --config
argument:
steampipe_export_gcp --config '<your_config>' gcp_compute_backend_service