steampipe plugin install gcp

Table: gcp_compute_instance_group - Query Google Cloud Compute Engine Instance Groups using SQL

Google Cloud Compute Engine Instance Groups are collections of virtual machine (VM) instances that you can manage as a single entity. When they are managed by Instance Group Managers, these groups are called Managed Instance Groups (MIG), and are ideal for highly available applications that require a lot of computing power and need to scale rapidly to meet demand. They offer a range of features including autoscaling, autohealing, regional (multiple zone) deployment, and automatic updating. Otherwise, these groups are called Unmanaged Instance Groups, and can contain heterogeneous instances that you can arbitrarily add and remove from them, but do not offer autoscaling, autohealing, rolling update support, multi-zone support, or the use of instance templates and are not a good fit for deploying highly available and scalable workloads, they can just be used for load balancing.

Table Usage Guide

The gcp_compute_instance_group table provides insights into instance groups within Google Cloud Compute Engine. As a system administrator, you can explore group-specific details through this table, including configuration, associated instances, and autoscaling policies. Utilize it to monitor the status of your instance groups, manage load balancing, and plan for capacity adjustments.

Examples

Basic Info

Discover the segments of your Google Cloud Platform (GCP) that contain instance groups, gaining insights into aspects like size and location. This can help in project management and resource allocation within the GCP infrastructure.

select
name,
description,
self_link,
size,
location,
akas,
project
from
gcp_compute_instance_group;
select
name,
description,
self_link,
size,
location,
akas,
project
from
gcp_compute_instance_group;

Get number of instances per instance group

Analyze the distribution of instances across different groups in your Google Cloud Platform's compute engine. This allows you to manage resources effectively and plan for future scaling needs.

select
name,
size as no_of_instances
from
gcp_compute_instance_group;
select
name,
size as no_of_instances
from
gcp_compute_instance_group;

Get instance details of each instance group

Explore the status of each instance within a group to gain insights into their operational status. This can help in managing resources more effectively and identifying any instances that may be experiencing issues.

select
g.name,
ins.name as instance_name,
ins.status as instance_status
from
gcp_compute_instance_group as g,
jsonb_array_elements(instances) as i,
gcp_compute_instance as ins
where
(i ->> 'instance') = ins.self_link;
select
g.name,
ins.name as instance_name,
ins.status as instance_status
from
gcp_compute_instance_group as g,
json_each(instances) as i,
gcp_compute_instance as ins
where
json_extract(i.value, '$.instance') = ins.self_link;

Get network and subnetwork info of each instance group

Analyze the network configuration of each instance group to gain insights into the associated network and subnetwork details, such as the IP range, gateway address and location. This can be useful for assessing the network distribution of your resources.

select
g.name as instance_group_name,
n.name as network_name,
s.name as subnetwork_name,
s.ip_cidr_range,
s.gateway_address,
n.location
from
gcp_compute_instance_group as g,
gcp_compute_network as n,
gcp_compute_subnetwork as s
where
g.network = n.self_link
and g.subnetwork = s.self_link;
select
g.name as instance_group_name,
n.name as network_name,
s.name as subnetwork_name,
s.ip_cidr_range,
s.gateway_address,
n.location
from
gcp_compute_instance_group as g,
gcp_compute_network as n,
gcp_compute_subnetwork as s
where
g.network = n.self_link
and g.subnetwork = s.self_link;

Schema for gcp_compute_instance_group

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
creation_timestamptimestamp with time zoneTimestamp when the instance group was created.
descriptiontextAn optional description of this resource. Provide this property when you create the resource.
fingerprinttextThe fingerprint of the instance group.
idbigintThe unique identifier for this instance group. This identifier is defined by the server.
instancesjsonbList of instances that belongs to this group.
kindtextType of the resource. Always compute#instanceGroup for instance groups.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
nametext=Name of the instance group.
named_portsjsonbAssigns a name to a port number.
networktextThe URL of the network to which all instances in the instance group belong.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
regiontextThe URL of the region where the instance group resides. Only applicable for regional resources.
region_nametextName of the region where the instance group resides. Only applicable for regional resources.
self_linktextServer-defined fully-qualified URL for this resource.
sizebigintThe total number of instances in the instance group.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
subnetworktextThe URL of the subnetwork to which all instances in the instance group belong.
titletextTitle of the resource.
zonetextThe URL of the zone where the instance group resides.
zone_nametextThe zone name in which the instance group resides.

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_instance_group