steampipe plugin install gcp

Table: gcp_compute_machine_type - Query Google Cloud Platform Compute Machine Types using SQL

Google Cloud Platform's Compute Engine provides predefined machine types that you can use to get the right balance of resources for your applications. Each machine type comes with a specific number of vCPUs and amount of memory, and they are grouped into different families based on the ratio of CPU to memory. Machine types help you to meet your specific performance and cost requirements.

Table Usage Guide

The gcp_compute_machine_type table provides insights into the available machine types within Google Cloud Platform's Compute Engine. As a cloud architect or DevOps engineer, you can explore machine type-specific details through this table, including vCPU count, memory, and associated metadata. Utilize it to understand the specifications of each machine type, aiding in the selection of the most suitable machine type for your applications based on performance requirements and cost efficiency.

Examples

Basic info

Assess the elements within your Google Cloud Platform to understand the capacity and capabilities of each machine type. This can help optimize resource allocation, by identifying the maximum number of persistent disks and their total size each machine can support.

select
name,
id,
description,
guest_cpus,
maximum_persistent_disks,
maximum_persistent_disks_size_gb
from
gcp_compute_machine_type;
select
name,
id,
description,
guest_cpus,
maximum_persistent_disks,
maximum_persistent_disks_size_gb
from
gcp_compute_machine_type;

List machine types with more than 48 cores

Determine the areas in which machine types have high processing power, specifically those with more than 48 cores. This can help in identifying high-performance options for resource-intensive applications.

select
name,
id,
description,
guest_cpus
from
gcp_compute_machine_type
where
guest_cpus >= 48;
select
name,
id,
description,
guest_cpus
from
gcp_compute_machine_type
where
guest_cpus >= 48;

List machine types with shared CPUs

Determine the types of machines that utilize shared CPUs to optimize resource allocation and enhance performance efficiency.

select
name,
id,
is_shared_cpu
from
gcp_compute_machine_type
where
is_shared_cpu;
select
name,
id,
is_shared_cpu
from
gcp_compute_machine_type
where
is_shared_cpu = 1;

Get accelerator configurations assigned to each machine type

Analyze machine configurations to understand the number and type of accelerators assigned to each. This is beneficial in optimizing resource allocation and performance in a GCP compute environment.

select
name,
id,
a -> 'guestAcceleratorCount' as guest_accelerator_count,
a ->> 'guestAcceleratorType' as guest_accelerator_type
from
gcp_compute_machine_type,
jsonb_array_elements(accelerators) as a;
select
m.name,
m.id,
json_extract(a.value, '$.guestAcceleratorCount') as guest_accelerator_count,
json_extract(a.value, '$.guestAcceleratorType') as guest_accelerator_type
from
gcp_compute_machine_type as m,
json_each(accelerators) as a;

Display the categorization of machine types by zone

Explore which machine types are most prevalent in each zone. This can help in understanding the distribution of resources and planning for future infrastructure needs.

select
name,
zone,
count(name) as numbers_of_machine_type
from
gcp_compute_machine_type
group by
name,
zone;
select
name,
zone,
count(name) as numbers_of_machine_type
from
gcp_compute_machine_type
group by
name,
zone;

Schema for gcp_compute_machine_type

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
acceleratorsjsonbA list of accelerator configurations assigned to this machine type.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
creation_timestamptimestamp with time zoneCreation timestamp in RFC3339 text format.
deprecatedjsonbThe deprecation status associated with this machine type. Only applicable if the machine type is unavailable.
descriptiontextAn optional textual description of the resource.
guest_cpusbigintThe number of virtual CPUs that are available to the instance.
idbigintAn unique identifier for the resource. This identifier is defined by the server.
image_space_gbbigintThe amount of memory available for image ig GB.
is_shared_cpubooleanWhether this machine type has a shared CPU.
kindtextThe type of the resource. Always compute#machineType for machine types.
maximum_persistent_disksbigintMaximum persistent disks allowed.
maximum_persistent_disks_size_gbbigintMaximum total persistent disks size (GB) allowed.
memory_mbbigintThe amount of physical memory available to the instance, defined in MB.
nametext=Name of the resource.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
scratch_disksjsonbA list of extended scratch disks assigned to the instance.
self_linktextServer-defined URL for the resource.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
titletextTitle of the resource.
zonetext=The name of the zone where the machine type resides, such as us-central1-a.

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_machine_type