-
Notifications
You must be signed in to change notification settings - Fork 11
/
update.sh
executable file
·32 lines (26 loc) · 1.15 KB
/
update.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
#!/bin/bash
set -e
echo "Specify your SAP SystemID (3 letters):"
read sapsid
echo "Specify your password for user SAPMONITOR"
read sappassword
echo 'Prepare ChangeSet...'
json=$(aws cloudformation describe-stacks --stack-name serverlessrepo-sap-monitor-$sapsid --query 'Stacks[*].Parameters')
json=$(sed 's/\*\*\*\*/'$sappassword'/g' <<< $json)
json=$(sed 's/ParameterKey/Name/g' <<< $json)
json=$(sed 's/ParameterValue/Value/g' <<< $json)
json=$(sed 's/\[ \[/\[/g' <<< $json)
json=$(sed 's/\] \]/\]/g' <<< $json)
changeARN=$(aws serverlessrepo create-cloud-formation-change-set \
--application-id arn:aws:serverlessrepo:eu-central-1:529824580566:applications/sap-monitor \
--stack-name sap-monitor-$sapsid \
--capabilities CAPABILITY_RESOURCE_POLICY CAPABILITY_IAM \
--parameter-overrides "$json" \
--query "ChangeSetId")
changeARN=$(sed -e 's/^"//' -e 's/"$//' <<<"$changeARN")
echo 'Wait 30 seconds...'
sleep 30
echo 'Deploy...'
aws cloudformation execute-change-set --change-set-name $changeARN
aws cloudformation describe-stacks --stack-name serverlessrepo-sap-monitor-$sapsid --query 'Stacks[*].Tags'
echo 'All done! Check AWS CloudFormation console for any errors!'