-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·31 lines (26 loc) · 1.13 KB
/
deploy.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
#!/bin/bash
read -p "Enter AWS profile to use for deployment [default]: " PROFILE
PROFILE=${PROFILE:-default}
echo $PROFILE
read -p "Enter a stack name [Keep-RDS-DB-Stopped]: " STACK_NAME
STACK_NAME=${STACK_NAME:-Keep-RDS-DB-Stopped}
echo $STACK_NAME
read -p "Enter 'c' for keeping a cluster stopped, 'i' for an instance [c]: " DB_OPTION
DB_OPTION=${DB_OPTION:-c}
echo $DB_OPTION
if [ "$DB_OPTION" == "c" ]; then
aws --profile $PROFILE cloudformation deploy \
--stack-name $STACK_NAME \
--template-file ./stop-db-cluster/main.yml \
--parameter-overrides file://stop-db-cluster/params.json \
--capabilities CAPABILITY_NAMED_IAM
elif [ "$DB_OPTION" == "i" ]; then
aws --profile $PROFILE cloudformation deploy \
--stack-name $STACK_NAME \
--template-file ./stop-db-instance/main.yml \
--parameter-overrides file://stop-db-instance/params.json \
--capabilities CAPABILITY_NAMED_IAM
else
echo "Invalid choice. Please select either 'c' for cluster or 'i' for instance."
fi
echo "Congrats, your DB will now be stopped indefinitely (online at most as long as your polling schedule)"