title | description |
---|---|
Steampipe Table: gcp_compute_instance_template - Query Google Cloud Compute Engine Instance Templates using SQL |
Allows users to query Instance Templates in Google Cloud Compute Engine, specifically providing details about the configuration of virtual machine instances in an instance group. |
Table: gcp_compute_instance_template - Query Google Cloud Compute Engine Instance Templates using SQL
An Instance Template in Google Cloud Compute Engine is a resource that provides a way to create instances based on a template. This allows for the uniform deployment of multiple instances that have the same configurations. Instance Templates define the machine type, boot disk image or container image, labels, and other instance properties.
The gcp_compute_instance_template
table provides insights into Instance Templates within Google Cloud Compute Engine. As a DevOps engineer, explore template-specific details through this table, including machine type, boot disk image, labels, and other instance properties. Utilize it to uncover information about templates, such as those with specific configurations, the uniform deployment of multiple instances, and the verification of instance properties.
Discover the segments that utilize the 'c2-standard-4' machine type within Google Cloud Platform's compute instances. This is particularly useful for assessing resource allocation and planning for future infrastructure needs.
select
name,
id,
instance_machine_type
from
gcp_compute_instance_template
where
instance_machine_type = 'c2-standard-4';
select
name,
id,
instance_machine_type
from
gcp_compute_instance_template
where
instance_machine_type = 'c2-standard-4';
Determine the characteristics of each instance template's boot disk in a GCP compute environment. This can be useful to assess the disk type, size, and source image, which can aid in capacity planning and performance optimization.
select
name,
id,
disk ->> 'deviceName' as disk_device_name,
disk -> 'initializeParams' ->> 'diskType' as disk_type,
disk -> 'initializeParams' ->> 'diskSizeGb' as disk_size_gb,
split_part(
disk -> 'initializeParams' ->> 'sourceImage',
'/',
5
) as source_image,
disk ->> 'mode' as mode
from
gcp_compute_instance_template,
jsonb_array_elements(instance_disks) as disk;
Error: SQLite does not support split functions.
Analyze the settings to understand which instance templates in the Google Cloud Platform are specifically set to consume reservations. This can help optimize resource allocation and cost management in cloud environments.
select
name,
id,
instance_reservation_affinity ->> 'consumeReservationType' as consume_reservation_type
from
gcp_compute_instance_template
where
instance_reservation_affinity ->> 'consumeReservationType' = 'SPECIFIC_RESERVATION';
select
name,
id,
json_extract(instance_reservation_affinity, '$.consumeReservationType') as consume_reservation_type
from
gcp_compute_instance_template
where
json_extract(instance_reservation_affinity, '$.consumeReservationType') = 'SPECIFIC_RESERVATION';
Determine the network interface details of each instance template in your GCP Compute Engine to understand the network configuration and access settings in each instance. This will help in identifying any irregularities or inconsistencies in the network setup.
select
name,
id,
i ->> 'name' as name,
split_part(i ->> 'network', '/', 10) as network_name,
p ->> 'name' as access_config_name,
p ->> 'networkTier' as access_config_network_tier,
p ->> 'type' as access_config_type
from
gcp_compute_instance_template,
jsonb_array_elements(instance_network_interfaces) as i,
jsonb_array_elements(i -> 'accessConfigs') as p;
Error: SQLite does not support split or string_to_array functions.
Discover the segments that have the ability to forward IP, a useful feature for routing network traffic effectively and securely. This can be particularly beneficial in scenarios where you need to manage traffic flow across different network interfaces.
select
name,
id,
instance_can_ip_forward
from
gcp_compute_instance_template
where
instance_can_ip_forward;
select
name,
id,
instance_can_ip_forward
from
gcp_compute_instance_template
where
instance_can_ip_forward = 1;