steampipe plugin install gcp

Table: gcp_compute_autoscaler - Query GCP Compute Autoscalers using SQL

Google Cloud Platform's Compute Autoscaler is a service that automatically adjusts the number of virtual machine instances in a managed instance group based on the increase or decrease in load. It allows you to maintain the number of instances in your project so you can ensure that your application has the available resources to handle its work demand. This service is particularly useful for applications that experience variable levels of demand.

Table Usage Guide

The gcp_compute_autoscaler table provides insights into the autoscaling configurations in Google Cloud Platform's Compute Engine. As a cloud engineer, explore autoscaler-specific details through this table, including the target that the autoscaler is configured to scale, the policy that defines the autoscaler behavior, and the operational status of the autoscaler. Utilize it to manage and optimize your resources, ensuring that your application has the necessary resources to handle its work demand.

Examples

Basic Info

Explore the basic details of your Google Cloud Platform's compute autoscalers, such as their names, statuses, and recommended sizes. This information can be useful in understanding your autoscaler setup and identifying areas for potential optimization.

select
name,
description,
self_link,
status,
location,
akas,
recommended_size
from
gcp_compute_autoscaler;
select
name,
description,
self_link,
status,
location,
akas,
recommended_size
from
gcp_compute_autoscaler;

Get auto scaling policy for autoscalers

Explore the configuration of auto scaling policies applied to autoscalers to better manage computational resources and optimize system performance.

select
title,
autoscaling_policy ->> 'mode' as mode,
autoscaling_policy -> 'cpuUtilization' ->> 'predictiveMethod' as cpu_utilization_method,
autoscaling_policy -> 'cpuUtilization' ->> 'utilizationTarget' as cpu_utilization_target,
autoscaling_policy ->> 'maxNumReplicas' as max_replicas,
autoscaling_policy ->> 'minNumReplicas' as min_replicas,
autoscaling_policy ->> 'coolDownPeriodSec' as cool_down_period_sec
from
gcp_compute_autoscaler;
select
title,
json_extract(autoscaling_policy, '$.mode') as mode,
json_extract(
autoscaling_policy,
'$.cpuUtilization.predictiveMethod'
) as cpu_utilization_method,
json_extract(
autoscaling_policy,
'$.cpuUtilization.utilizationTarget'
) as cpu_utilization_target,
json_extract(autoscaling_policy, '$.maxNumReplicas') as max_replicas,
json_extract(autoscaling_policy, '$.minNumReplicas') as min_replicas,
json_extract(autoscaling_policy, '$.coolDownPeriodSec') as cool_down_period_sec
from
gcp_compute_autoscaler;

Get autoscalers with configuration errors

Discover the autoscalers in your Google Cloud Platform that are encountering configuration errors. This can help in identifying and rectifying issues that could potentially hinder the automatic scaling of your resources.

select
name,
description,
self_link,
status,
location,
akas,
recommended_size
from
gcp_compute_autoscaler
where
status = 'ERROR';
select
name,
description,
self_link,
status,
location,
akas,
recommended_size
from
gcp_compute_autoscaler
where
status = 'ERROR';

Get instance groups having autoscaling enabled

Identify the groups of instances that have autoscaling enabled to ensure optimal resource allocation and cost efficiency. This is particularly useful for managing large-scale applications and maintaining performance during peak load times.

select
a.title as autoscaler_name,
g.name as instance_group_name,
g.description as instance_group_description,
g.size as instance_group_size
from
gcp_compute_instance_group g,
gcp_compute_autoscaler a
where
g.name = split_part(a.target, 'instanceGroupManagers/', 2);
select
a.title as autoscaler_name,
g.name as instance_group_name,
g.description as instance_group_description,
g.size as instance_group_size
from
gcp_compute_instance_group g,
gcp_compute_autoscaler a
where
g.name = substr(
a.target,
instr(a.target, 'instanceGroupManagers/') + length('instanceGroupManagers/')
);

Schema for gcp_compute_autoscaler

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
autoscaling_policyjsonbThe configuration parameters for the autoscaling algorithm.
creation_timestamptimestamp with time zoneTimestamp when the Autoscaler was created.
descriptiontextAn optional description of this resource. Provide this property when you create the resource.
idbigintThe unique identifier for this Autoscaler. This identifier is defined by the server.
kindtextType of the resource. Always compute#autoscaler for Autoscalers.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
nametext=Name of the Autoscaler.
projecttextThe GCP Project in which the resource is located.
recommended_sizebigintTarget recommended MIG size (number of instances) computed by autoscaler.
regiontextThe URL of the region where the Autoscaler resides. Only applicable for regional resources.
region_nametextName of the region where the Autoscaler resides. Only applicable for regional resources.
scaling_schedule_statusjsonbStatus information of existing scaling schedules.
self_linktextServer-defined fully-qualified URL for this resource.
statustextThe status of the autoscaler configuration.
status_detailsjsonbHuman-readable details about the current state of the autoscaler.
targettextURL of the managed instance group that this autoscaler will scale.
titletextTitle of the resource.
zonetextURL of the zone where the Autoscaler resides.
zone_nametextThe zone name in which the Autoscaler 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_autoscaler