-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
30 lines (30 loc) · 1.19 KB
/
run.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
#!/bin/bash
if [[ $1 == "deploy" ]]; then
aws cloudformation create-stack \
--stack-name URL-REDIRECTER \
--capabilities CAPABILITY_NAMED_IAM \
--template-body file://./redirect.template.yaml \
--parameters \
ParameterKey=FromDomain,ParameterValue=$2 \
ParameterKey=ToProtocol,ParameterValue=$3 \
ParameterKey=ToDomain,ParameterValue=$4 \
ParameterKey=HostedZoneId,ParameterValue=$5 \
ParameterKey=FromDomainAcmArn,ParameterValue=$6
aws cloudformation wait stack-create-complete --stack-name URL-REDIRECTER
fi
if [[ $1 == "update" ]]; then
aws cloudformation update-stack \
--stack-name URL-REDIRECTER \
--capabilities CAPABILITY_NAMED_IAM \
--template-body file://./redirect.template.yaml \
--parameters \
ParameterKey=FromDomain,ParameterValue=$2 \
ParameterKey=ToProtocol,ParameterValue=$3 \
ParameterKey=ToDomain,ParameterValue=$4 \
ParameterKey=HostedZoneId,ParameterValue=$5 \
ParameterKey=FromDomainAcmArn,ParameterValue=$6
aws cloudformation wait stack-update-complete --stack-name URL-REDIRECTER
fi
if [[ $1 == "delete" ]]; then
aws cloudformation delete-stack --stack-name URL-REDIRECTER
fi