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_gbfrom gcp_compute_machine_type;
select name, id, description, guest_cpus, maximum_persistent_disks, maximum_persistent_disks_size_gbfrom 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_cpusfrom gcp_compute_machine_typewhere guest_cpus >= 48;
select name, id, description, guest_cpusfrom gcp_compute_machine_typewhere 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_cpufrom gcp_compute_machine_typewhere is_shared_cpu;
select name, id, is_shared_cpufrom gcp_compute_machine_typewhere 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_typefrom 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_typefrom 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_typefrom gcp_compute_machine_typegroup by name, zone;
select name, zone, count(name) as numbers_of_machine_typefrom gcp_compute_machine_typegroup by name, zone;
Schema for gcp_compute_machine_type
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
accelerators | jsonb | A list of accelerator configurations assigned to this machine type. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
creation_timestamp | timestamp with time zone | Creation timestamp in RFC3339 text format. | |
deprecated | jsonb | The deprecation status associated with this machine type. Only applicable if the machine type is unavailable. | |
description | text | An optional textual description of the resource. | |
guest_cpus | bigint | The number of virtual CPUs that are available to the instance. | |
id | bigint | An unique identifier for the resource. This identifier is defined by the server. | |
image_space_gb | bigint | The amount of memory available for image ig GB. | |
is_shared_cpu | boolean | Whether this machine type has a shared CPU. | |
kind | text | The type of the resource. Always compute#machineType for machine types. | |
maximum_persistent_disks | bigint | Maximum persistent disks allowed. | |
maximum_persistent_disks_size_gb | bigint | Maximum total persistent disks size (GB) allowed. | |
memory_mb | bigint | The amount of physical memory available to the instance, defined in MB. | |
name | text | = | Name of the resource. |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
scratch_disks | jsonb | A list of extended scratch disks assigned to the instance. | |
self_link | text | Server-defined URL for the resource. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
title | text | Title of the resource. | |
zone | text | = | 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