-
Notifications
You must be signed in to change notification settings - Fork 0
/
oregon-deep.sh
executable file
·61 lines (53 loc) · 1.39 KB
/
oregon-deep.sh
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
#!/bin/bash
#
# Offer some default options for an Ubuntu instance, interactively.
if [ "$#" -gt 4 ] || [ "$1" = "--help" ]; then
echo "Usage: east-deep.sh [name] [instancetype] [ami] [open-extra]"
echo "Thin wrapper with defaults around setup-instance.sh"
echo "See description in aws-magic/README.md"
exit 1
fi
region=$(aws configure get region)
if [ $region != "us-west-2" ]; then
echo "us-west-2 (oregon) region only"
exit 1
fi
if [ "$#" -gt 0 ]; then
name="$1"
else
i=0
while [ -d "$HOME/aws-instances/s$i" ] ; do
let i++
done
dfl="s$i"
read -p "choose server name [$dfl]: " name
name=${name:-$dfl}
fi
if [ -d "$name" ]; then
echo "error: directory ~/aws-instances/$name already exists"
exit 1
fi
if [ "$#" -gt 1 ]; then
instancetype="$2"
else
dfl="g3.8xlarge"
read -p "choose instance type [$dfl]: " instancetype
instancetype=${instancetype:-$dfl}
fi
if [ "$#" -gt 2 ]; then
ami="$3"
else
dfl="ami-01a4e5be5f289dd12"
read -p "choose ami [$dfl, Deep Learn 22.0 Ubuntu]: " ami
ami=${ami:-$dfl}
fi
if [ "$#" -gt 3 ]; then
open_extra="$4"
else
read -p "open ports 6006,8888-8898 in addition to 22 (Y/n)?" yn
case "$yn" in
[Yy]* ) open_extra="true" ;;
* ) open_extra="false" ;;
esac
fi
$(dirname $(readlink -f "$0"))/setup-instance.sh "$ami" "$instancetype" "$name" "$open_extra"