-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch-env.sh
executable file
·64 lines (59 loc) · 2.54 KB
/
launch-env.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
62
63
64
#!/bin/bash
## launch a single team for sko 2019
if [ "${1}" == "help" ]
then
echo -e "Usage: something like below. see script source for detail \n ./launch-env.sh <stackname> <teamname> <passwordForEverything> <dsmUserName> <awsKeyPair> <smartCheckAc> <dsAc> <optionalAwsCliProfile>"
exit 1
else
echo -e "\n\n\n\n\n\n building stack with: \n \n passwords=${3} \n teamname=${2} \n sccode=${6} \n dscode=${7} \n keyname=${5} dsmuser=${4} \n\n\n\n\n "
fi
stackname=${1}
teamname=${2}
bastionpassword=${3}
jenkinspassword=${3}
smartcheckpassword=${3}
dsmuser=${4}
keyname=${5}
smartcheckcode=${6}
dscode=${7}
profile=${9:-default}
eventname=demo
if [ -e ~/.aws/config ]
then
echo "Building stack with cli profile"
aws cloudformation create-stack --debug --disable-rollback \
--stack-name $1 \
--capabilities CAPABILITY_IAM \
--template-url "https://s3-us-west-2.amazonaws.com/tm-aws-containers-security-demo/v1-1/lean-formation.yml" \
--tags Key=TdcEvent,Value=${eventname} \
--region us-east-1 \
--profile ${profile} \
--parameters \
ParameterKey=JenkinsPassword,ParameterValue=${jenkinspassword} \
ParameterKey=BastionPassword,ParameterValue=${bastionpassword} \
ParameterKey=SmartCheckPassword,ParameterValue=${bastionpassword} \
ParameterKey=TeamName,ParameterValue=${teamname} \
ParameterKey=SmartCheckActivationCode,ParameterValue=${smartcheckcode} \
ParameterKey=DSActivationCode,ParameterValue=${dscode} \
ParameterKey=KeyName,ParameterValue=${keyname} \
ParameterKey=EventName,ParameterValue=${eventname} \
ParameterKey=DevOpsDsmUser,ParameterValue=${dsmuser}
else
echo "Building stack without cli profile"
aws cloudformation create-stack --debug --disable-rollback \
--stack-name $1 \
--capabilities CAPABILITY_IAM \
--template-url "https://s3-us-west-2.amazonaws.com/tm-aws-containers-security-demo/v1-1/lean-formation.yml" \
--tags Key=TdcEvent,Value=${eventname} \
--region us-east-1 \
--parameters \
ParameterKey=JenkinsPassword,ParameterValue=${jenkinspassword} \
ParameterKey=BastionPassword,ParameterValue=${bastionpassword} \
ParameterKey=SmartCheckPassword,ParameterValue=${bastionpassword} \
ParameterKey=TeamName,ParameterValue=${teamname} \
ParameterKey=SmartCheckActivationCode,ParameterValue=${smartcheckcode} \
ParameterKey=DSActivationCode,ParameterValue=${dscode} \
ParameterKey=KeyName,ParameterValue=${keyname} \
ParameterKey=EventName,ParameterValue=${eventname} \
ParameterKey=DevOpsDsmUser,ParameterValue=${dsmuser}
fi