Skip to content

Commit fdce933

Browse files
committed
Updated teh doc with latest format
1 parent 27a2ecd commit fdce933

File tree

1 file changed

+123
-8
lines changed

1 file changed

+123
-8
lines changed

docs/tables/gcp_compute_machine_image.md

+123-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
1-
# Table: gcp_compute_machine_image
1+
---
2+
title: "Steampipe Table: gcp_compute_machine_image - Query Google Cloud Platform Compute Machine Image using SQL"
3+
description: "Allows users to query Compute Machine Images in Google Cloud Platform, providing detailed information about available machine images and their specifications."
4+
---
5+
6+
# Table: gcp_compute_machine_image - Query Google Cloud Platform Compute Machine Image using SQL
27

38
A machine image is a Compute Engine resource that stores all the configuration, metadata, permissions, and data from multiple disks of a virtual machine (VM) instance. You can use a machine image in many system maintenance, backup and recovery, and instance cloning scenarios.
49

10+
## Table Usage Guide
11+
12+
The `gcp_compute_machine_image` table provides insights into the available machine images within Google Cloud Platform's Compute Engine. As a cloud architect or DevOps engineer, you can explore machine image-specific details through this table, kind, source instance, instance properties, image status, image storage, and associated metadata. Utilize it to understand the specifications of each machine image, aiding in the selection of the most suitable machine image for your applications based on performance requirements and cost efficiency.
13+
514
## Examples
615

716
### Basic info
17+
Assess the elements within your Google Cloud Platform to understand the capacity and capabilities of each machine image. This can help to get the metadata about the compute images.
18+
19+
```sql+postgres
20+
select
21+
name,
22+
id,
23+
description,
24+
creation_timestamp,
25+
guest_flush,
26+
source_instance
27+
from
28+
gcp_compute_machine_image;
29+
```
830

9-
```sql
31+
```sql+sqlite
1032
select
1133
name,
1234
id,
@@ -19,8 +41,22 @@ from
1941
```
2042

2143
### List machine images that are available
44+
Ensures that only machine images that are ready for deployment or use are considered, which is critical for operational stability and reliability. Useful in automated scripts or applications where only machine images in a 'READY' state should be utilized. Helps in maintaining a clean and efficient image repository by focusing on images that are fully prepared and excluding those that are still in preparation or have been deprecated.
45+
46+
```sql+postgres
47+
select
48+
name,
49+
id,
50+
description,
51+
creation_timestamp,
52+
status
53+
from
54+
gcp_compute_machine_image
55+
where
56+
status = 'READY';
57+
```
2258

23-
```sql
59+
```sql+sqlite
2460
select
2561
name,
2662
id,
@@ -34,8 +70,23 @@ where
3470
```
3571

3672
### List the top 5 machine images that consume highest storage
73+
This query is particularly useful in cloud infrastructure management and optimization, where understanding and managing storage utilization is a key concern. It helps administrators and users quickly identify the most space-efficient machine images available in their GCP environment.
74+
75+
```sql+postgres
76+
select
77+
name,
78+
id,
79+
self_link,
80+
status,
81+
total_storage_bytes
82+
from
83+
gcp_compute_machine_image
84+
order by
85+
total_storage_bytes asc
86+
limit 5;
87+
```
3788

38-
```sql
89+
```sql+sqlite
3990
select
4091
name,
4192
id,
@@ -45,12 +96,14 @@ select
4596
from
4697
gcp_compute_machine_image
4798
order by
48-
total_storage_bytes asc;
99+
total_storage_bytes asc
100+
limit 5;
49101
```
50102

51103
### Get instance properties of the machine images
104+
Useful for analyzing the detailed configurations of machine images, including hardware features, network settings, and security configurations. Assists in planning and optimizing cloud infrastructure based on the capabilities and configurations of available machine images.
52105

53-
```sql
106+
```sql+postgres
54107
select
55108
name,
56109
id,
@@ -79,9 +132,39 @@ from
79132
gcp_compute_machine_image;
80133
```
81134

135+
```sql+sqlite
136+
select
137+
name,
138+
id,
139+
json_extract(instance_properties, '$.advancedMachineFeatures') as advanced_machine_features,
140+
json_extract(instance_properties, '$.canIpForward') as can_ip_forward,
141+
json_extract(instance_properties, '$.confidentialInstanceConfig') as confidential_instance_config,
142+
json_extract(instance_properties, '$.description') as description,
143+
json_extract(instance_properties, '$.disks') as disks,
144+
json_extract(instance_properties, '$.guestAccelerators') as guest_accelerators,
145+
json_extract(instance_properties, '$.keyRevocationActionType') as key_revocation_action_type,
146+
json_extract(instance_properties, '$.labels') as labels,
147+
json_extract(instance_properties, '$.machineType') as machine_type,
148+
json_extract(instance_properties, '$.metadata') as metadata,
149+
json_extract(instance_properties, '$.minCpuPlatform') as min_cpu_platform,
150+
json_extract(instance_properties, '$.networkInterfaces') as network_interfaces,
151+
json_extract(instance_properties, '$.networkPerformanceConfig') as network_performance_config,
152+
json_extract(instance_properties, '$.privateIpv6GoogleAccess') as private_ipv6_google_access,
153+
json_extract(instance_properties, '$.reservationAffinity') as reservation_affinity,
154+
json_extract(instance_properties, '$.resourceManagerTags') as resource_manager_tags,
155+
json_extract(instance_properties, '$.resourcePolicies') as resource_policies,
156+
json_extract(instance_properties, '$.scheduling') as scheduling,
157+
json_extract(instance_properties, '$.serviceAccounts') as service_accounts,
158+
json_extract(instance_properties, '$.shieldedInstanceConfig') as shielded_instance_config,
159+
json_extract(instance_properties, '$.tags') as tags
160+
from
161+
gcp_compute_machine_image;
162+
```
163+
82164
### Get encryption details of the machine image
165+
Understanding the encryption methods and keys used for each machine image is vital for security and compliance. It helps ensure that sensitive data is properly protected and that the encryption methods meet required standards. The query aids in auditing the encryption practices and managing the encryption keys across different machine images. It's particularly useful in environments with strict data protection policies.
83166

84-
```sql
167+
```sql+postgres
85168
select
86169
name,
87170
machine_image_encryption_key ->> 'KmsKeyName' as kms_key_name,
@@ -93,9 +176,22 @@ from
93176
gcp_compute_machine_image;
94177
```
95178

179+
```sql+sqlite
180+
select
181+
name,
182+
json_extract(machine_image_encryption_key, '$.KmsKeyName') as kms_key_name,
183+
json_extract(machine_image_encryption_key, '$.KmsKeyServiceAccount') as kms_key_service_account,
184+
json_extract(machine_image_encryption_key, '$.RawKey') as raw_key,
185+
json_extract(machine_image_encryption_key, '$.RsaEncryptedKey') as rsa_encrypted_key,
186+
json_extract(machine_image_encryption_key, '$.Sha256') as sha256
187+
from
188+
gcp_compute_machine_image;
189+
```
190+
96191
### Get the machine type details for the machine images
192+
Analyzing the memory, CPU, and disk capabilities of machine types can inform decisions about image deployment based on performance needs. Knowing the deprecation status and creation timestamp of machine types helps in compliance and migration planning.
97193

98-
```sql
194+
```sql+postgres
99195
select
100196
i.name as image_name,
101197
i.id image_id,
@@ -111,4 +207,23 @@ from
111207
gcp_compute_machine_type as t
112208
where
113209
t.name = (i.instance_properties ->> 'machineType') and t.zone = split_part(i.source_instance, '/', 9);
210+
```
211+
212+
```sql+sqlite
213+
select
214+
i.name as image_name,
215+
i.id as image_id,
216+
json_extract(i.instance_properties, '$.machineType') as machine_type,
217+
t.creation_timestamp as machine_type_creation_timestamp,
218+
t.memory_mb as machine_type_memory_mb,
219+
t.maximum_persistent_disks as machine_type_maximum_persistent_disks,
220+
t.is_shared_cpu as machine_type_is_shared_cpu,
221+
t.zone as machine_type_zone,
222+
t.deprecated as machine_type_deprecated
223+
from
224+
gcp_compute_machine_image as i,
225+
gcp_compute_machine_type as t
226+
where
227+
t.name = json_extract(i.instance_properties, '$.machineType')
228+
and t.zone = substr(i.source_instance, instr(i.source_instance, '/', -1) + 1);
114229
```

0 commit comments

Comments
 (0)