steampipe plugin install gcp

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_name
from
gcp_compute_url_map;
select
name,
id,
default_service_name
from
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 service
from
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_matcher
from
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_matcher
from
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_type
from
gcp_compute_url_map
where
location_type = 'GLOBAL';
select
name,
id,
location_type
from
gcp_compute_url_map
where
location_type = 'GLOBAL';

Schema for gcp_compute_url_map

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
creation_timestamptimestamp with time zoneThe creation timestamp of the resource.
default_route_actionjsonbDefaultRouteAction 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_servicetextThe full or partial URL of the defaultService resource to which traffic is directed if none of the hostRules match.
default_service_nametextThe defaultService name of resource to which traffic is directed if none of the hostRules match.
default_url_host_redirecttextThe 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_redirectbooleanSpecifies whether the URL scheme in the redirected request is set to https, or not.
default_url_path_redirecttextThe path that will be used in the redirect response instead of the one that was supplied in the request.
default_url_prefix_redirecttextThe prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request.
default_url_redirect_response_codetextSpecifies the HTTP Status code to use for this RedirectAction.
default_url_strip_querybooleanSpecifies whether any accompanying query portion of the original URL is removed prior to redirecting the request, or not.
descriptiontextA user-specified, human-readable description of the URL map.
fingerprinttextAn unique system generated string, to reduce conflicts when multiple users change any property of the resource.
host_rulesjsonbThe list of HostRules to use against the URL.
idbigintThe unique identifier for the resource.
kindtextThe type of the resource.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
location_typetextLocation type where the url map resides.
nametext=A friendly name that identifies the resource.
path_matchersjsonbThe list of named PathMatchers to use against the URL.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
regiontextThe URL of the region where the regional backend service resides. This field is not applicable to global backend services.
request_headers_to_addjsonbA list of headers to add to a matching request prior to forwarding the request to the backendService.
request_headers_to_removejsonbA 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_addjsonbA list of headers to add the response prior to sending the response back to the client.
response_headers_to_removejsonbA list of header names for headers that need to be removed from the response prior to sending the response back to the client.
self_linktextThe server-defined URL for the resource.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
testsjsonbThe list of expected URL mapping tests. Request to update this UrlMap will succeed only if all of the test cases pass.
titletextTitle 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