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_sizefrom gcp_compute_autoscaler;
select name, description, self_link, status, location, akas, recommended_sizefrom 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_secfrom 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_secfrom 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_sizefrom gcp_compute_autoscalerwhere status = 'ERROR';
select name, description, self_link, status, location, akas, recommended_sizefrom gcp_compute_autoscalerwhere 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_sizefrom gcp_compute_instance_group g, gcp_compute_autoscaler awhere 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_sizefrom gcp_compute_instance_group g, gcp_compute_autoscaler awhere g.name = substr( a.target, instr(a.target, 'instanceGroupManagers/') + length('instanceGroupManagers/') );
Query examples
Schema for gcp_compute_autoscaler
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. | |
autoscaling_policy | jsonb | The configuration parameters for the autoscaling algorithm. | |
creation_timestamp | timestamp with time zone | Timestamp when the Autoscaler was created. | |
description | text | An optional description of this resource. Provide this property when you create the resource. | |
id | bigint | The unique identifier for this Autoscaler. This identifier is defined by the server. | |
kind | text | Type of the resource. Always compute#autoscaler for Autoscalers. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
name | text | = | Name of the Autoscaler. |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
recommended_size | bigint | Target recommended MIG size (number of instances) computed by autoscaler. | |
region | text | The URL of the region where the Autoscaler resides. Only applicable for regional resources. | |
region_name | text | Name of the region where the Autoscaler resides. Only applicable for regional resources. | |
scaling_schedule_status | jsonb | Status information of existing scaling schedules. | |
self_link | text | Server-defined fully-qualified URL for this resource. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
status | text | The status of the autoscaler configuration. | |
status_details | jsonb | Human-readable details about the current state of the autoscaler. | |
target | text | URL of the managed instance group that this autoscaler will scale. | |
title | text | Title of the resource. | |
zone | text | URL of the zone where the Autoscaler resides. | |
zone_name | text | The 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