steampipe plugin install gcp

Table: gcp_compute_region - Query Google Cloud Platform Compute Regions using SQL

A Compute Region in Google Cloud Platform is a specific geographical location where you can deploy your resources. Each region is a separate geographic area that consists of zones. Zones are essentially the deployment areas within a region where users can deploy their resources to ensure high availability and disaster recovery.

Table Usage Guide

The gcp_compute_region table provides insights into the Compute Regions within Google Cloud Platform (GCP). As a cloud engineer or system administrator, use this table to explore region-specific details, including available zones, quotas, and related metadata. This can be particularly useful for planning resource deployment, ensuring high availability, and managing disaster recovery strategies.

Examples

List of compute regions which are down

Identify the specific regions in your Google Cloud Platform's compute engine that are currently non-operational. This is useful for quickly pinpointing areas of your infrastructure that may be causing disruptions or outages.

select
name,
id,
status
from
gcp_compute_region
where
status = 'DOWN';
select
name,
id,
status
from
gcp_compute_region
where
status = 'DOWN';

Get the quota info for a region (us-west1)

Analyze the settings to understand the quota limits for a specific region. This is useful for managing resources and preventing overuse.

select
name,
q -> 'metric' as quota_metric,
q -> 'limit' as quota_limit
from
gcp_compute_region,
jsonb_array_elements(quotas) as q
where
name = 'us-west1'
order by
quota_metric;
select
name,
json_extract(q.value, '$.metric') as quota_metric,
json_extract(q.value, '$.limit') as quota_limit
from
gcp_compute_region,
json_each(quotas) as q
where
name = 'us-west1'
order by
quota_metric;

Get the available zone info of each region

Explore which zones are available in each region to optimize resource allocation and manage your resources efficiently across different geographical locations.

select
name,
zone_names
from
gcp_compute_region;
select
name,
zone_names
from
gcp_compute_region;

Count the available zone in each region

Identify the number of available zones within each region to better distribute resources and maintain system balance.

select
name,
jsonb_array_length(zone_names) as zone_count
from
gcp_compute_region;
select
name,
json_array_length(zone_names) as zone_count
from
gcp_compute_region;

Schema for gcp_compute_region

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
descriptiontextTextual description of the resource.
idtextThe unique identifier for the region.
kindtextType of the resource. Always compute#region for regions.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
nametext!=, =The name of the region.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
quotasjsonbQuotas assigned to this region.
self_linktextServer-defined URL for the region.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statustext!=, =Status of the region, either UP or DOWN.
titletextTitle of the resource.
zone_namesjsonbA list of zones available in this region, in the form of zone_id.
zonesjsonbA list of zones available in this region, in the form of resource URLs.

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_region