steampipe plugin install gcp

Table: gcp_compute_network - Query Google Cloud Platform Compute Networks using SQL

A Google Cloud Platform Compute Network is a virtual version of the traditional physical networks that exist within and between physical data centers. A network provides the communication path between your Compute Engine virtual machine (VM) instances. They are global resources, spanning all regions, and are used to define the network topology, such as subnetworks and network peering connections.

Table Usage Guide

The gcp_compute_network table provides insights into Compute Networks within Google Cloud Platform. As a network engineer or cloud architect, you can use this table to explore network-specific details, including its subnetworks, firewall rules, and routing configurations. This allows you to manage and optimize your network infrastructure effectively, ensuring secure and efficient communication paths within your Google Cloud environment.

Examples

List networks having auto create subnetworks feature disabled

Identify the networks that have the auto-create subnetworks feature turned off. This can be useful for assessing network configurations where manual subnet creation is preferred for more control over network segmentation.

select
name,
id,
auto_create_subnetworks
from
gcp_compute_network
where
not auto_create_subnetworks;
select
name,
id,
auto_create_subnetworks
from
gcp_compute_network
where
auto_create_subnetworks = 0;

List networks having routing_mode set to REGIONAL

Discover the segments that have their routing mode set to 'REGIONAL' within your network settings. This can be useful in understanding and managing network traffic flow within specific regions.

select
name,
id,
routing_mode
from
gcp_compute_network
where
routing_mode = 'REGIONAL';
select
name,
id,
routing_mode
from
gcp_compute_network
where
routing_mode = 'REGIONAL';

Subnets counts for each network

Explore which networks have the most subnets, allowing you to understand the distribution of subnets across your networks for better resource management and allocation.

select
name,
count(d) as num_subnets
from
gcp_compute_network as i,
jsonb_array_elements(subnetworks) as d
group by
name;
select
g.name,
count(d.value) as num_subnets
from
gcp_compute_network g,
json_each(g.subnetworks) as d
group by
g.name;

Schema for gcp_compute_network

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
auto_create_subnetworksboolean!=, =When set to true, the VPC network is created in auto mode. When set to false, the VPC network is created in custom mode.
creation_timestamptimestamp with time zoneCreation timestamp in RFC3339 text format.
descriptiontextAn optional description of this resource. Provide this field when you create the resource.
gateway_ipv4inetThe gateway address for default routing out of the network, selected by GCP
idbigintThe unique identifier for the resource. This identifier is defined by the server.
ipv4_rangecidrThe range of internal addresses that are legal on this network. Deprecated in favor of subnet mode networks. This range is a CIDR specification, for example: 192.168.0.0/16. Provided by the client when the network is created.
kindtextType of the resource. Always compute#network for networks.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
mtubigintMaximum Transmission Unit in bytes. The minimum value for this field is 1460 and the maximum value is 1500 bytes.
nametext=Name of the resource. Provided by the client when the resource is created.
peeringsjsonbA list of network peerings for the resource. NetworkPeering: A network peering attached to a network resource. The message includes the peering name, peer network, peering state, and a flag indicating whether Google Compute Engine should automatically create routes for the peering
projecttextThe GCP Project in which the resource is located.
routing_modetextThe network-wide routing mode to use. If set to REGIONAL, this network's Cloud Routers will only advertise routes with subnets of this network in the same region as the router. If set to GLOBAL, this network's Cloud Routers will advertise routes with all subnets of this network, across regions. Possible values: "GLOBAL" "REGIONAL"
self_linktextServer-defined URL for the resource.
subnetworksjsonbServer-defined fully-qualified URLs for all subnetworks in this VPC network.
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_network