17 lines
892 B
Bash
Executable File
17 lines
892 B
Bash
Executable File
#!/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
|