Table: gcp_compute_router - Query Google Cloud Platform Compute Routers using SQL
A Compute Router in Google Cloud Platform is a resource that helps connect different networks within the cloud. It is a distributed, software-defined router that offers a reliable way to route traffic between virtual machines (VMs) and networks, regardless of their location. Compute Routers provide a scalable and flexible solution for managing network traffic in the cloud.
Table Usage Guide
The gcp_compute_router
table provides insights into Compute Routers within Google Cloud Platform. As a network administrator or cloud engineer, explore router-specific details through this table, including the network it is associated with, its region, and its operational status. Utilize it to manage and monitor your network's traffic routing configurations and to ensure optimal network performance.
Examples
Cloud router basic info
Explore the basic information related to cloud routers, such as their name and configuration settings. This could be useful for understanding their network behaviour and managing network routing protocols effectively.
select name, bgp_asn, bgp_advertise_modefrom gcp_compute_router;
select name, bgp_asn, bgp_advertise_modefrom gcp_compute_router;
NAT gateway info attached to router
Discover the settings of your NAT gateway that's linked to a router to understand its configuration and operational parameters. This can aid in network management by providing insights into features like endpoint independent mapping and IP allocation options.
select name, nat ->> 'name' as nat_name, nat ->> 'enableEndpointIndependentMapping' as enable_endpoint_independent_mapping, nat ->> 'natIpAllocateOption' as nat_ip_allocate_option, nat ->> 'sourceSubnetworkIpRangesToNat' as source_subnetwork_ip_ranges_to_natfrom gcp_compute_router, jsonb_array_elements(nats) as nat;
select name, json_extract(nat.value, '$.name') as nat_name, json_extract(nat.value, '$.enableEndpointIndependentMapping') as enable_endpoint_independent_mapping, json_extract(nat.value, '$.natIpAllocateOption') as nat_ip_allocate_option, json_extract(nat.value, '$.sourceSubnetworkIpRangesToNat') as source_subnetwork_ip_ranges_to_natfrom gcp_compute_router, json_each(nats) as nat;
List all routers with custom route advertisements
Explore which routers have custom route advertisements to better manage network traffic and understand your network's routing protocols. This is particularly useful when you want to assess the elements within your network that are using custom configurations for route advertisements.
select name, bgp_asn, bgp_advertise_mode, bgp_advertised_ip_rangesfrom gcp_compute_routerwhere bgp_advertise_mode = 'CUSTOM';
select name, bgp_asn, bgp_advertise_mode, bgp_advertised_ip_rangesfrom gcp_compute_routerwhere bgp_advertise_mode = 'CUSTOM';
Query examples
Schema for gcp_compute_router
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. | |
bgp_advertise_mode | text | An user-specified flag to indicate which mode to use for advertisement. | |
bgp_advertised_groups | jsonb | An user-specified list of prefix groups to advertise in custom mode. | |
bgp_advertised_ip_ranges | jsonb | User-specified list of individual IP ranges to advertise in custom mode. This field can only be populated if advertise_mode is CUSTOM and is advertised to all peers of the router. These IP ranges will be advertised in addition to any specified groups. | |
bgp_asn | bigint | Specifies the local BGP Autonomous System Number (ASN). | |
bgp_peers | jsonb | BGP information that must be configured into the routing stack to establish BGP peering. This information must specify the peer ASN and either the interface name, IP address, or peer IP address. | |
creation_timestamp | timestamp with time zone | The creation timestamp of the resource. | |
description | text | A user-specified, human-readable description of the router. | |
id | bigint | The unique identifier for the resource. | |
interfaces | jsonb | An list of router interfaces. | |
kind | text | The type of the resource. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
name | text | = | A friendly name that identifies the resource. |
nats | jsonb | A list of NAT services created in this router. | |
network | text | The URI of the network to which this router belongs. | |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
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. | |
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_router