You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/tables/gcp_compute_machine_image.md
+123-8
Original file line number
Diff line number
Diff 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
2
7
3
8
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.
4
9
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
+
5
14
## Examples
6
15
7
16
### 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
+
```
8
30
9
-
```sql
31
+
```sql+sqlite
10
32
select
11
33
name,
12
34
id,
@@ -19,8 +41,22 @@ from
19
41
```
20
42
21
43
### 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
+
```
22
58
23
-
```sql
59
+
```sql+sqlite
24
60
select
25
61
name,
26
62
id,
@@ -34,8 +70,23 @@ where
34
70
```
35
71
36
72
### 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
+
```
37
88
38
-
```sql
89
+
```sql+sqlite
39
90
select
40
91
name,
41
92
id,
@@ -45,12 +96,14 @@ select
45
96
from
46
97
gcp_compute_machine_image
47
98
order by
48
-
total_storage_bytes asc;
99
+
total_storage_bytes asc
100
+
limit 5;
49
101
```
50
102
51
103
### 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.
52
105
53
-
```sql
106
+
```sql+postgres
54
107
select
55
108
name,
56
109
id,
@@ -79,9 +132,39 @@ from
79
132
gcp_compute_machine_image;
80
133
```
81
134
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
+
82
164
### 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.
83
166
84
-
```sql
167
+
```sql+postgres
85
168
select
86
169
name,
87
170
machine_image_encryption_key ->> 'KmsKeyName' as kms_key_name,
@@ -93,9 +176,22 @@ from
93
176
gcp_compute_machine_image;
94
177
```
95
178
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
+
96
191
### 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.
0 commit comments