34 lines
760 B
Bash
34 lines
760 B
Bash
|
#!/bin/bash
|
||
|
cat <<EOF > /tmp/ec2-raw.txt
|
||
|
m5.large 2 8
|
||
|
m5.xlarge 4 16
|
||
|
m5.2xlarge 8 32
|
||
|
m5.4xlarge 16 64
|
||
|
m5.8xlarge 32 128
|
||
|
c5.large 2 4
|
||
|
c5.xlarge 4 8
|
||
|
c5.2xlarge 8 16
|
||
|
c5.4xlarge 16 32
|
||
|
c5.9xlarge 36 72
|
||
|
c5.12xlarge 48 96
|
||
|
r5.large 2 16
|
||
|
r5.xlarge 4 32
|
||
|
r5.2xlarge 8 64
|
||
|
r5.4xlarge 16 128
|
||
|
r5.8xlarge 32 256
|
||
|
EOF
|
||
|
|
||
|
if [ ! -f ec2-size-match.db ]; then
|
||
|
echo "create table instances(instance varchar(30), cpu int, ram int)" | sqlite3 ec2-size-match.db
|
||
|
cat /tmp/ec2-raw.txt | while read a b c; do
|
||
|
echo "insert into instances values(\"$a\", \"$b\", \"$c\");" | sqlite3 ec2-size-match.db
|
||
|
done
|
||
|
fi
|
||
|
|
||
|
RESULT=$(echo "select instance from instances where cpu = \"$1\" and ram = \"$2\";" | sqlite3 ec2-size-match.db)
|
||
|
if [ -z "$RESULT" ]; then
|
||
|
echo manual-match
|
||
|
else
|
||
|
echo $RESULT
|
||
|
fi
|