steampipe plugin install gcp

Table: gcp_compute_disk - Query Google Cloud Compute Engine Disks using SQL

Google Cloud Compute Engine Disks are persistent, high-performance block storage for Google Cloud's Virtual Machines (VMs). They are used to store data and serve as the primary storage for data used by VMs. These disks are automatically encrypted, durable, and offer up to 64 TB of space.

Table Usage Guide

The gcp_compute_disk table provides insights into disks within Google Cloud Compute Engine. As a system administrator, you can explore disk-specific details through this table, including their sizes, types, and associated instances. Utilize it to monitor and manage your storage resources effectively, ensuring optimal performance and cost-efficiency.

Examples

Basic info

Explore which Google Cloud Platform (GCP) compute disks are being used, their locations, and their respective sizes. This information can be beneficial for managing storage resources and optimizing costs.

select
name,
id,
size_gb as disk_size_in_gb,
type_name,
zone_name,
region_name,
location_type
from
gcp_compute_disk;
select
name,
id,
size_gb as disk_size_in_gb,
type_name,
zone_name,
region_name,
location_type
from
gcp_compute_disk;

List disks encrypted with Google-managed key

Explore which disks are encrypted using a Google-managed key to ensure compliance with your organization's data security policies. This can help in identifying potential security vulnerabilities and maintaining data privacy standards.

select
name,
id,
zone_name,
disk_encryption_key_type
from
gcp_compute_disk
where
disk_encryption_key_type = 'Google managed';
select
name,
id,
zone_name,
disk_encryption_key_type
from
gcp_compute_disk
where
disk_encryption_key_type = 'Google managed';

List disks that are not in use

Discover the segments that include unused disks in your Google Cloud Platform compute disk storage. This can be beneficial in identifying potential areas for cost optimization and resource management.

select
name,
id,
users
from
gcp_compute_disk
where
users is null;
select
name,
id,
users
from
gcp_compute_disk
where
users is null;

List regional disks

Explore which disks are regionally located in your Google Cloud Platform's compute engine. This is useful for understanding the distribution of your resources and ensuring data is stored in the appropriate geographical areas.

select
name,
region_name
from
gcp_compute_disk
where
location_type = 'REGIONAL';
select
name,
region_name
from
gcp_compute_disk
where
location_type = 'REGIONAL';

Count the number of disks per availability zone

Analyze the distribution of your storage resources by determining the total number of disks available in each zone. This information can be utilized to efficiently manage and balance your storage resources across different zones.

select
zone_name,
count(*)
from
gcp_compute_disk
group by
zone_name
order by
count desc;
select
zone_name,
count(*)
from
gcp_compute_disk
group by
zone_name
order by
count(*) desc;

List disks ordered by size

Analyze your Google Cloud Platform's compute disk storage to understand which disks are consuming the most space. This can help manage storage efficiently by identifying disks that may need to be resized or cleaned up.

select
name,
size_gb
from
gcp_compute_disk
order by
size_gb desc;
select
name,
size_gb
from
gcp_compute_disk
order by
size_gb desc;

Schema for gcp_compute_disk

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
creation_timestamptimestamp with time zoneTimestamp when the disk was created.
descriptiontextAn optional description of this resource. Provide this property when you create the resource.
disk_encryption_keyjsonbSpecifies the encryption configuration used to encrypt stored data.
disk_encryption_key_typetextThe type of encryption key used to encrypt storage data. Valid values are Google managed | Customer managed | Customer supplied.
guest_os_featuresjsonbA list of features to enable on the guest operating system. Applicable only for bootable images.
iam_policyjsonbAn Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members` to a single `role`. Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`.
idbigintThe unique identifier for the resource. This identifier is defined by the server.
kindtextType of the resource. Always compute#disk for disks.
labelsjsonbA map of labels assigned to bucket
last_attach_timestamptimestamp with time zoneTimestamp when the disk was last attached.
last_detach_timestamptimestamp with time zoneTimestamp when the disk was last detached.
license_codesjsonbInteger license codes indicating which licenses are attached to this disk.
licensesjsonbA list of publicly visible licenses.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
location_typetextLocation type where the disk resides.
nametext!=, =Name of the resource.
physical_block_size_bytesbigintPhysical block size of the persistent disk, in bytes. If not present in a request, a default value is used.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
regiontextURL of the region where the disk resides. Only applicable for regional resources.
region_nametextName of the region where the disk resides. Only applicable for regional resources.
replica_zonesjsonbURLs of the zones where the disk should be replicated to. Only applicable for regional resources.
resource_policiesjsonbResource policies applied to this disk for automatic snapshot creations.
self_linktextServer-defined fully-qualified URL for this resource.
size_gbdouble precisionSize, in GB, of the persistent disk.
source_disktextThe source disk used to create this disk. You can provide this as a partial or full URL to the resource.
source_disk_idtextThe unique ID of the disk used to create this disk. This value identifies the exact disk that was used to create this persistent disk.
source_imagetextThe source image used to create this disk. If the source image is deleted, this field will not be set.
source_image_encryption_keytextThe customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key.
source_image_idtextThe ID value of the image used to create this disk. This value identifies the exact image that was used to create this persistent disk.
source_snapshottextThe source snapshot used to create this disk.
source_snapshot_encryption_keytextThe customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key.
source_snapshot_idtextThe unique ID of the snapshot used to create this disk. This value identifies the exact snapshot that was used to create this persistent disk.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statustext!=, =The status of disk creation. CREATING: Disk is provisioning. RESTORING: Source data is being copied into the disk. FAILED: Disk creation failed. READY: Disk is ready for use. DELETING: Disk is deleting.
tagsjsonbA map of tags for the resource.
titletextTitle of the resource.
typetextURL of the disk type resource describing which disk type to use to create the disk. Provide this when creating the disk. For example: projects/project/zones/zone/diskTypes/pd-standard or pd-ssd
type_nametextType of the disk. For example: pd-standard or pd-ssd
usersjsonbLinks to the users of the disk (attached instances) in form: projects/project/zones/zone/instances/instance
zonetextURL of the zone where the disk resides.
zone_nametextThe zone name in which the disk 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_disk