steampipe plugin install gcp

Table: gcp_alloydb_instance - Query Google Cloud Platform AlloyDB Instances using SQL

Google Cloud AlloyDB is a fully managed PostgreSQL-compatible database service, optimized for high performance with the reliability of Google's infrastructure. AlloyDB Instances within a cluster offer flexible options for scaling and redundancy, meeting the needs of demanding database applications.

Table Usage Guide

The gcp_alloydb_instance table can be queried to retrieve detailed information about individual AlloyDB instances within a cluster. It is invaluable for database administrators and system architects looking to monitor instance-specific performance, understand configuration details, and manage resource allocation effectively.

Examples

Basic Information Query

Retrieve essential details about all AlloyDB instances to quickly get an overview of your instances' configurations and statuses.

select
name,
state,
availability_type,
display_name
from
gcp_alloydb_instance;
select
name,
state,
availability_type,
display_name
from
gcp_alloydb_instance;

List Instances by Availability Type

This query is useful for identifying instances according to their availability setup, which helps in understanding your database's fault tolerance and geographic distribution.

select
name,
availability_type,
state
from
gcp_alloydb_instance
where
availability_type = 'REGIONAL';
select
name,
availability_type,
state
from
gcp_alloydb_instance
where
availability_type = 'REGIONAL';

Find Instances with Specific Labels

Labels are key-value pairs assigned to instances and can be used for organization and access control. This query helps filter instances based on these labels.

select
name,
labels
from
gcp_alloydb_instance
where
labels -> 'environment' = 'production';
select
name,
json_extract(labels, '$.environment') as environment
from
gcp_alloydb_instance
where
environment = 'production';

Instances Currently in Maintenance

This query helps in identifying which instances are currently undergoing maintenance, allowing for better planning and reduced downtime impact.

select
name,
state
from
gcp_alloydb_instance
where
state = 'MAINTENANCE';
select
name,
state
from
gcp_alloydb_instance
where
state = 'MAINTENANCE';

Detailed View of Instance Configurations

Gain a deeper understanding of the configurations for a specific instance, useful for troubleshooting or planning upgrades.

select
name,
machine_config,
client_connection_config,
ip_address
from
gcp_alloydb_instance
where
name = 'instance-12345';
select
name,
json_extract(machine_config, '$') as machine_config,
json_extract(client_connection_config, '$') as client_connection_config,
ip_address
from
gcp_alloydb_instance
where
name = 'instance-12345';

Get node details of the instances

Retrieve information about the nodes.

select
name,
node -> 'Id' as node_id,
node -> 'Ip' as node_ip,
node -> 'State' as node_state,
node -> 'ZoneId' as node_zone_id
from
gcp_alloydb_instance,
jsonb_array_elements(nodes) as node;
select
name,
json_extract(node, '$.Id') as node_id,
json_extract(node, '$.Ip') as node_ip,
json_extract(node, '$.State') as node_state,
json_extract(node, '$.ZoneId') as node_zone_id
from
gcp_alloydb_instance,
json_each(json(nodes)) as node;

Schema for gcp_alloydb_instance

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
annotationsjsonbAnnotations to allow client tools to store a small amount of arbitrary data.
availability_typetextAvailability type of the instance.
client_connection_configjsonbClient connection specific configurations.
cluster_nametext=User-settable display name for the cluster.
connection_infojsonbConnectionInfo singleton resource.
create_timetimestamp with time zoneCreation time of the instance.
database_flagsjsonbDatabase flags set at the instance level.
delete_timetimestamp with time zoneDeletion time of the instance.
etagtextResource freshness validation.
gce_zonetextCompute Engine zone where the instance is located.
instance_display_nametext=User-settable display name for the instance.
instance_typetextType of the instance.
ip_addressinetIP address assigned to the instance.
labelsjsonbLabels as key-value pairs.
locationtext=The GCP multi-region, region, or zone in which the resource is located.
machine_configjsonbConfigurations for the machines that host the underlying database engine.
nametextThe resource name of the instance.
nodesjsonbList of available read-only VMs in this instance.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
query_insights_configjsonbConfiguration for query insights.
read_pool_configjsonbRead pool instance configuration.
reconcilingbooleanIndicates if the instance is reconciling.
satisfies_pzsbooleanReserved for future use.
self_linktextServer-defined URL for the resource.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statetextCurrent serving state of the instance.
titletextTitle of the resource.
uidtextSystem-generated UID of the resource.
update_timetimestamp with time zoneLast update time of the instance.
writable_nodejsonbThis is set for the read-write VM of the PRIMARY instance only.

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_alloydb_instance