Table: gcp_compute_url_map - Query Google Cloud Compute Engine URL Maps using SQL
A URL Map in Google Cloud Compute Engine is a key component of the HTTP(S) load balancing service. It defines the rules that route HTTP(S) traffic from an HTTP(S) load balancer to backend services, backend buckets, or other URL map targets. URL Maps contain both host rules and path matchers to control the flow of traffic.
Table Usage Guide
The gcp_compute_url_map
table provides insights into URL Maps within Google Cloud Compute Engine. As a network engineer, explore URL Map-specific details through this table, including routing rules, host rules, and associated metadata. Utilize it to uncover information about URL Maps, such as the traffic flow, the backend services or buckets the traffic is directed to, and the verification of host rules.
Examples
Get the default backend service of each url-map
Explore which backend service is set as the default for each URL map in your Google Cloud Platform compute instance. This can help in understanding how your web traffic is being directed and managed.
select name, id, default_service_namefrom gcp_compute_url_map;
select name, id, default_service_namefrom gcp_compute_url_map;
Path matcher info of each url-map
Explore the relationship between URL maps and their associated path matchers in your Google Cloud Platform setup. This can help identify areas for optimization or troubleshooting within your web service routing configuration.
select name, id, p ->> 'name' as name, r ->> 'paths' as paths, split_part(r ->> 'service', '/', 10) as servicefrom gcp_compute_url_map, jsonb_array_elements(path_matchers) as p, jsonb_array_elements(p -> 'pathRules') as r;
Error: SQLite does not support split_part function.
Host rule info of each url-map
Explore which URL maps have specific host rules in your Google Cloud Platform. This can help in identifying potential misconfigurations or anomalies in the distribution of network traffic.
select name, id, p ->> 'hosts' as hosts, p ->> 'pathMatcher' as path_matcherfrom gcp_compute_url_map, jsonb_array_elements(host_rules) as p;
select u.name, u.id, json_extract(p.value, '$.hosts') as hosts, json_extract(p.value, '$.pathMatcher') as path_matcherfrom gcp_compute_url_map as u, json_each(host_rules) as p;
List of all global type url-maps
Explore the global URL maps within your Google Cloud Platform's compute service. This can aid in managing and routing network traffic effectively.
select name, id, location_typefrom gcp_compute_url_mapwhere location_type = 'GLOBAL';
select name, id, location_typefrom gcp_compute_url_mapwhere location_type = 'GLOBAL';
Control examples
Schema for gcp_compute_url_map
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
creation_timestamp | timestamp with time zone | The creation timestamp of the resource. | |
default_route_action | jsonb | DefaultRouteAction takes effect when none of the hostRules match. The load balancer performs advanced routing actions like URL rewrites, header transformations, etc. prior to forwarding the request to the selected backend. If defaultRouteAction specifies any weightedBackendServices, defaultService must not be set. | |
default_service | text | The full or partial URL of the defaultService resource to which traffic is directed if none of the hostRules match. | |
default_service_name | text | The defaultService name of resource to which traffic is directed if none of the hostRules match. | |
default_url_host_redirect | text | The host that will be used in the redirect response instead of the one that was supplied in the request. The value must be between 1 and 255 characters. | |
default_url_https_redirect | boolean | Specifies whether the URL scheme in the redirected request is set to https, or not. | |
default_url_path_redirect | text | The path that will be used in the redirect response instead of the one that was supplied in the request. | |
default_url_prefix_redirect | text | The prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request. | |
default_url_redirect_response_code | text | Specifies the HTTP Status code to use for this RedirectAction. | |
default_url_strip_query | boolean | Specifies whether any accompanying query portion of the original URL is removed prior to redirecting the request, or not. | |
description | text | A user-specified, human-readable description of the URL map. | |
fingerprint | text | An unique system generated string, to reduce conflicts when multiple users change any property of the resource. | |
host_rules | jsonb | The list of HostRules to use against the URL. | |
id | bigint | The unique identifier for the resource. | |
kind | text | The type of the resource. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
location_type | text | Location type where the url map resides. | |
name | text | = | A friendly name that identifies the resource. |
path_matchers | jsonb | The list of named PathMatchers to use against the URL. | |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
region | text | The URL of the region where the regional backend service resides. This field is not applicable to global backend services. | |
request_headers_to_add | jsonb | A list of headers to add to a matching request prior to forwarding the request to the backendService. | |
request_headers_to_remove | jsonb | A list of header names for headers that need to be removed from the request prior to forwarding the request to the backendService. | |
response_headers_to_add | jsonb | A list of headers to add the response prior to sending the response back to the client. | |
response_headers_to_remove | jsonb | A list of header names for headers that need to be removed from the response prior to sending the response back to the client. | |
self_link | text | The server-defined URL for the resource. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
tests | jsonb | The list of expected URL mapping tests. Request to update this UrlMap will succeed only if all of the test cases pass. | |
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_url_map