-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy path02_get.sh
More file actions
executable file
·119 lines (108 loc) · 4.15 KB
/
Copy path02_get.sh
File metadata and controls
executable file
·119 lines (108 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env bash
set -e
#
# Export all Google Compute Engine machine types and zones via the
# Google Compute Engine API and create CSV file
#
source "00_config.sh"
echo "Download pricing..."
curl -fsSL -O "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/raw/master/pricing.yml"
# Create CSV file with machine types
echo "Executing: 'gcloud compute machine-types list', please wait..."
printf "%s;" \
"name" \
"description" \
"zone" \
"guestCpus" \
"isSharedCpu" \
"memoryGB" \
"guestAcceleratorCount" \
"guestAcceleratorType" \
"maximumPersistentDisks" \
"maximumPersistentDisksSizeGb" \
"deprecated" > "$CSV_GCLOUD_MACHINE_TYPES"
echo "" >> "$CSV_GCLOUD_MACHINE_TYPES"
gcloud compute machine-types list \
--quiet \
--filter="ZONE:-" \
--format="csv[no-heading,separator=';']( \
name, \
description, \
zone, \
guestCpus, \
isSharedCpu, \
MEMORY_GB, \
accelerators.guestAcceleratorCount, \
accelerators.guestAcceleratorType, \
maximumPersistentDisks, \
maximumPersistentDisksSizeGb, \
deprecated.state)" >> "$CSV_GCLOUD_MACHINE_TYPES"
# Create CSV file with zones and available CPU platforms
echo "Executing: 'gcloud compute zones list', please wait..."
printf "%s;" \
"name" \
"availableCpuPlatforms" > "$CSV_GCLOUD_ZONES"
echo "" >> "$CSV_GCLOUD_ZONES"
gcloud compute zones list \
--quiet \
--format="csv[no-heading,separator=';'](name, availableCpuPlatforms.list())" >> "$CSV_GCLOUD_ZONES"
# Fix Google Axion CPU platform name:
# Parse the CSV file line by line. If 'Google Axion' is in line and 'Google Axion_' remove 'Google Axion_'.
perl -i -pe "s/Google Axion_,//g if /Google Axion/" "$CSV_GCLOUD_ZONES"
perl -i -pe "s/Google Axion_//g if /Google Axion/" "$CSV_GCLOUD_ZONES"
# Create CSV file with disk types
echo "Executing: 'gcloud compute disk-types list', please wait..."
printf "%s;" \
"name" \
"zone" \
"description" > "$CSV_GCLOUD_DISK_TYPES"
echo "" >> "$CSV_GCLOUD_DISK_TYPES"
gcloud compute disk-types list \
--quiet \
--filter="ZONE:-" \
--format="csv[no-heading,separator=';']( \
name, \
zone, \
description)" >> "$CSV_GCLOUD_DISK_TYPES"
# Create CSV files with images
echo "Executing: 'gcloud compute images list', please wait..."
# Standard images
echo "name;description;diskSizeGb;project;family;architecture;creation;deprecated;status" > "$CSV_GCLOUD_IMAGES"
gcloud compute images list \
--quiet \
--format="csv[no-heading,separator=';'](NAME,description,diskSizeGb,PROJECT,FAMILY,architecture,creationTimestamp,DEPRECATED,STATUS)" >> "$CSV_GCLOUD_IMAGES"
# Community images
# https://cloud.google.com/compute/docs/images#almalinux
gcloud compute images list \
--project almalinux-cloud \
--no-standard-images \
--quiet \
--format="csv[no-heading,separator=';'](NAME,description,diskSizeGb,PROJECT,FAMILY,architecture,creationTimestamp,DEPRECATED,STATUS)" >> "$CSV_GCLOUD_IMAGES"
# https://cloud.google.com/compute/docs/images#freebsd
gcloud compute images list \
--project freebsd-org-cloud-dev \
--no-standard-images \
--quiet \
--format="csv[no-heading,separator=';'](NAME,description,diskSizeGb,PROJECT,FAMILY,architecture,creationTimestamp,DEPRECATED,STATUS)" >> "$CSV_GCLOUD_IMAGES"
# Deep Learning on Linux images
gcloud compute images list \
--project ml-images \
--filter="creationTimestamp > -P1Y" \
--no-standard-images \
--quiet \
--format="csv[no-heading,separator=';'](NAME,description,diskSizeGb,PROJECT,FAMILY,architecture,creationTimestamp,DEPRECATED,STATUS)" >> "$CSV_GCLOUD_IMAGES"
# https://cloud.google.com/deep-learning-vm/docs/images#listing-versions
gcloud compute images list \
--project deeplearning-platform-release \
--filter="creationTimestamp > -P1Y" \
--no-standard-images \
--quiet \
--format="csv[no-heading,separator=';'](NAME,description,diskSizeGb,PROJECT,FAMILY,architecture,creationTimestamp,DEPRECATED,STATUS)" >> "$CSV_GCLOUD_IMAGES"
# High Performance Computing (HPC)
gcloud compute images list \
--project cloud-hpc-image-public \
--filter="creationTimestamp > -P1Y" \
--no-standard-images \
--quiet \
--format="csv[no-heading,separator=';'](NAME,description,diskSizeGb,PROJECT,FAMILY,architecture,creationTimestamp,DEPRECATED,STATUS)" >> "$CSV_GCLOUD_IMAGES"
echo "DONE"