turbot/gcp

steampipe plugin install gcpsteampipe plugin install gcp
gcp_audit_policygcp_bigquery_datasetgcp_bigquery_jobgcp_bigquery_tablegcp_bigtable_instancegcp_cloudfunctions_functiongcp_compute_addressgcp_compute_backend_bucketgcp_compute_backend_servicegcp_compute_diskgcp_compute_disk_metric_read_opsgcp_compute_disk_metric_read_ops_dailygcp_compute_disk_metric_read_ops_hourlygcp_compute_disk_metric_write_opsgcp_compute_disk_metric_write_ops_dailygcp_compute_disk_metric_write_ops_hourlygcp_compute_firewallgcp_compute_forwarding_rulegcp_compute_global_addressgcp_compute_global_forwarding_rulegcp_compute_imagegcp_compute_instancegcp_compute_instance_metric_cpu_utilizationgcp_compute_instance_metric_cpu_utilization_dailygcp_compute_instance_metric_cpu_utilization_hourlygcp_compute_instance_templategcp_compute_machine_typegcp_compute_networkgcp_compute_node_groupgcp_compute_node_templategcp_compute_project_metadatagcp_compute_regiongcp_compute_resource_policygcp_compute_routergcp_compute_snapshotgcp_compute_ssl_policygcp_compute_subnetworkgcp_compute_target_https_proxygcp_compute_target_poolgcp_compute_target_ssl_proxygcp_compute_target_vpn_gatewaygcp_compute_url_mapgcp_compute_vpn_tunnelgcp_compute_zonegcp_dns_managed_zonegcp_dns_policygcp_dns_record_setgcp_iam_policygcp_iam_rolegcp_kms_keygcp_kms_key_ringgcp_logging_bucketgcp_logging_exclusiongcp_logging_metricgcp_logging_sinkgcp_monitoring_alert_policygcp_monitoring_groupgcp_monitoring_notification_channelgcp_organizationgcp_projectgcp_project_organization_policygcp_project_servicegcp_pubsub_snapshotgcp_pubsub_subscriptiongcp_pubsub_topicgcp_service_accountgcp_service_account_keygcp_sql_backupgcp_sql_databasegcp_sql_database_instancegcp_sql_database_instance_metric_connectionsgcp_sql_database_instance_metric_connections_dailygcp_sql_database_instance_metric_connections_hourlygcp_sql_database_instance_metric_cpu_utilizationgcp_sql_database_instance_metric_cpu_utilization_dailygcp_sql_database_instance_metric_cpu_utilization_hourlygcp_storage_bucket

Table: gcp_compute_snapshot

Snapshot is the backup of disk. It is a global resource, so it can be use to restore data to a new disk or instance within the same project.

Examples

Count of snapshots per disk

select
source_disk_name,
count(*) as snapshot_count
from
gcp_compute_snapshot
group by
source_disk_name;

List of manually created snapshots

select
name,
source_disk_name,
auto_created
from
gcp_compute_snapshot
where
not auto_created;

Disk info for each snapshot

select
s.name as snapshot_name,
d.name as disk_name,
d.size_gb as disk_size,
d.type_name as disk_type,
d.location_type
from
gcp_compute_snapshot as s
join gcp_compute_disk as d on s.source_disk = d.self_link;

List of snapshots older than 90 days

select
name,
creation_timestamp,
age(creation_timestamp)
from
gcp_compute_snapshot
where
creation_timestamp <= (current_date - interval '90' day)
order by
creation_timestamp;

List of snapshots with Google-managed key

select
name,
source_disk,
self_link
from
gcp_compute_snapshot
where
kms_key_name is null;

.inspect gcp_compute_snapshot

GCP Compute Snapshot

NameTypeDescription
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
auto_createdbooleanSet to true if snapshots are automatically created by applying resource policy on the target disk.
creation_timestamptimestamp without time zoneTimestamp when snapshot was created.
descriptiontextAn optional description of this resource.
disk_size_gbbigintSize of the source disk, specified in GB.
download_bytesbigintNumber of bytes downloaded to restore a snapshot to a disk.
encryption_key_raw_keytextSpecifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource.
encryption_key_sha256textThe RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource.
kms_key_nametextThe name of the encryption key that is used to encrypt snapshot
kms_key_service_accounttextThe service account being used for the encryption request for the given KMS key. If absent, the Compute Engine default service account is used.
label_fingerprinttextA fingerprint for the labels being applied to this snapshot, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels.
labelsjsonbLabels applied to this snapshot.
licensesjsonbA list of public visible licenses that apply to this snapshot. This can be because the original image had licenses attached (such as a Windows image).
locationtextThe GCP multi-region, region, or zone in which the resource is located.
nametextName of the resource; provided by the client when the resource is created.
projecttextThe GCP Project in which the resource is located.
self_linktextServer-defined URL for the resource.
source_disktextThe url of the source disk used to create this snapshot.
source_disk_encryption_keyjsonbThe customer-supplied encryption key of the source disk.
source_disk_nametextThe name of the source disk used to create this snapshot.
statustextThe status of the snapshot. This can be CREATING, DELETING, FAILED, READY, or UPLOADING.
storage_bytesbigintA size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
storage_bytes_statustextAn indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date.
storage_locationsjsonbCloud Storage bucket storage location of the snapshot (regional or multi-regional).
tagsjsonbA map of tags for the resource.
titletextTitle of the resource.