steampipe plugin install gcp

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_mode
from
gcp_compute_router;
select
name,
bgp_asn,
bgp_advertise_mode
from
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_nat
from
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_nat
from
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_ranges
from
gcp_compute_router
where
bgp_advertise_mode = 'CUSTOM';
select
name,
bgp_asn,
bgp_advertise_mode,
bgp_advertised_ip_ranges
from
gcp_compute_router
where
bgp_advertise_mode = 'CUSTOM';

Schema for gcp_compute_router

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
bgp_advertise_modetextAn user-specified flag to indicate which mode to use for advertisement.
bgp_advertised_groupsjsonbAn user-specified list of prefix groups to advertise in custom mode.
bgp_advertised_ip_rangesjsonbUser-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_asnbigintSpecifies the local BGP Autonomous System Number (ASN).
bgp_peersjsonbBGP 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_timestamptimestamp with time zoneThe creation timestamp of the resource.
descriptiontextA user-specified, human-readable description of the router.
idbigintThe unique identifier for the resource.
interfacesjsonbAn list of router interfaces.
kindtextThe type of the resource.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
nametext=A friendly name that identifies the resource.
natsjsonbA list of NAT services created in this router.
networktextThe URI of the network to which this router belongs.
projecttextThe GCP Project in which the resource is located.
self_linktextThe server-defined URL for the resource.
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_router