-
Notifications
You must be signed in to change notification settings - Fork 11
/
deploy.sh
29 lines (22 loc) · 1.01 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
#!/bin/bash
set -e
releaseID='b996f7cb309a21b7413ffc5234569471' # v.1.081
# Create Bucket if not exists
accountid=$(aws sts get-caller-identity --query Account --output text)
if aws s3 ls "s3://$accountid-sapmonitor" 2>&1 | grep -q 'NoSuchBucket'
then
echo "Create Amazon S3 Bucket to store artifacts"
aws s3 mb s3://$accountid-sapmonitor
fi
# Copy Artifacts
echo "Copy artifacts to S3 Bucket"
aws s3 cp s3://sap-monitor/$releaseID ./ --source-region eu-central-1
aws s3 cp $releaseID s3://$accountid-sapmonitor/$releaseID
# Upload YAML
echo "Adjust AWS CloudFormation Template"
wget https://github.com/aws-samples/amazon-cloudwatch-monitor-for-sap-netweaver/raw/master/packaged.yml
sed -i 's/s3\:\/\/sap-monitor\/'$releaseID'/s3\:\/\/'$accountid'-sapmonitor\/'$releaseID'/g' packaged.yml
aws s3 cp packaged.yml s3://$accountid-sapmonitor/packaged.yml
echo "All Done!"
echo "Create a new AWS CloudFormation stack by selecting Amazon S3 as template source:"
echo "https://$accountid-sapmonitor.s3.amazonaws.com/packaged.yml"