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, projectfrom gcp_compute_instance_group;
select name, description, self_link, size, location, akas, projectfrom 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_instancesfrom gcp_compute_instance_group;
select name, size as no_of_instancesfrom 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_statusfrom gcp_compute_instance_group as g, jsonb_array_elements(instances) as i, gcp_compute_instance as inswhere (i ->> 'instance') = ins.self_link;
select g.name, ins.name as instance_name, ins.status as instance_statusfrom gcp_compute_instance_group as g, json_each(instances) as i, gcp_compute_instance as inswhere 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.locationfrom gcp_compute_instance_group as g, gcp_compute_network as n, gcp_compute_subnetwork as swhere 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.locationfrom gcp_compute_instance_group as g, gcp_compute_network as n, gcp_compute_subnetwork as swhere g.network = n.self_link and g.subnetwork = s.self_link;
Query examples
- compute_autoscalers_for_compute_instance_group
- compute_backend_services_for_compute_instance_group
- compute_firewalls_for_compute_instance_group
- compute_instance_firewall_detail
- compute_instance_group_input
- compute_instance_group_network_detail
- compute_instance_group_overview
- compute_instance_group_size
- compute_instance_groups_for_compute_instance
- compute_instance_groups_for_compute_subnetwork
- compute_instance_groups_for_kubernetes_cluster
- compute_instances_for_compute_instance_group
- compute_instances_for_kubernetes_cluster
- compute_networks_for_compute_instance_group
- compute_subnets_for_compute_instance_group
- kubernetes_clusters_for_compute_instance_group
Schema for gcp_compute_instance_group
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
creation_timestamp | timestamp with time zone | Timestamp when the instance group was created. | |
description | text | An optional description of this resource. Provide this property when you create the resource. | |
fingerprint | text | The fingerprint of the instance group. | |
id | bigint | The unique identifier for this instance group. This identifier is defined by the server. | |
instances | jsonb | List of instances that belongs to this group. | |
kind | text | Type of the resource. Always compute#instanceGroup for instance groups. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
name | text | = | Name of the instance group. |
named_ports | jsonb | Assigns a name to a port number. | |
network | text | The URL of the network to which all instances in the instance group belong. | |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
region | text | The URL of the region where the instance group resides. Only applicable for regional resources. | |
region_name | text | Name of the region where the instance group resides. Only applicable for regional resources. | |
self_link | text | Server-defined fully-qualified URL for this resource. | |
size | bigint | The total number of instances in the instance group. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
subnetwork | text | The URL of the subnetwork to which all instances in the instance group belong. | |
title | text | Title of the resource. | |
zone | text | The URL of the zone where the instance group resides. | |
zone_name | text | The 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