NEW: script to gather vm instance spec from multicloud

This commit is contained in:
xpk 2022-01-19 08:37:24 +08:00
parent 230ff9ea7d
commit 9fe7340724
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#!/bin/bash
# Get AWS EC2 instances
links2 -dump https://aws.amazon.com/ec2/instance-types/ | pcre2grep '.*(micro|small|large)\s+[0-9]\s+[0-9]' | awk '{print "insert into instances values(\""$1 "\"," $2 "," $3 ",\"aws\");"}' > insert.sql
# Get GCP instances
links2 -dump https://cloud.google.com/compute/docs/general-purpose-machines | pcre2grep '(standard|high).*\s+[0-9]\s+[0-9]' | awk '{print "insert into instances values(\""$1"\",", $2, ",", $3, ",\"gcp\");"}' >> insert.sql
# Get alicloud instances
links2 -dump https://www.alibabacloud.com/help/en/doc-detail/108490.html | pcre2grep 'ecs.*[0-9]' | awk '{print "insert into instances values(\""$1"\",",$2","$3,",\"ali\");"}' >> insert.sql
echo "delete from instances;" | sqlite3 vm-spec.db
sqlite3 vm-spec.db < insert.sql
rm -f insert.sql
echo 'select provider, count(1) from instances group by "provider";' | sqlite3 vm-spec.db

BIN
cloud-vm-spec/vm-spec.db Normal file

Binary file not shown.