-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack_manager.sh
executable file
·53 lines (42 loc) · 1.62 KB
/
stack_manager.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
#!/bin/bash
if [ $# -ge 1 ];then
case $1 in
"create")
if [ $# -ne 6 ];then
echo "ERROR: Missing parameters!"
echo "Syntax: ${0} create STACK_NAME GITHUB_USER GITHUB_PROJECT GITHUB_REPO IMAGE_URI"
exit 1
fi
echo "CREATING STACK"
$(which aws) cloudformation create-stack --stack-name $2 --template-body \
file://cloudformation/main.yaml --parameters \
ParameterKey=GitHubUser,ParameterValue=$3 \
ParameterKey=GitHubToken,ParameterValue=$4 \
ParameterKey=GitHubRepo,ParameterValue=$5 \
ParameterKey=ImageUrl,ParameterValue=$6 \
--capabilities CAPABILITY_IAM
;;
"delete")
if [ $# -ne 2 ];then
echo "ERROR: Missing parameters!"
echo "Syntax: ${0} delete STACK_NAME"
exit 1
fi
echo "DELETING STACK"
$(which aws) cloudformation delete-stack --stack-name $2
;;
"describe")
if [ $# -ne 2 ];then
echo "ERROR: Missing parameters!"
echo "Syntax: ${0} describe STACK_NAME "
exit 1
fi
$(which aws) cloudformation describe-stacks --stack-name $2
;;
*)
echo "Syntax: $0 [create|delete|describe] <PARAMS> "
;;
esac
else
echo "Syntax: $0 [create|delete|describe] <PARAMS>"
fi