-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy paths3upload.sh
More file actions
executable file
·29 lines (25 loc) · 907 Bytes
/
s3upload.sh
File metadata and controls
executable file
·29 lines (25 loc) · 907 Bytes
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
if [ $# -ne 3 ]; then
echo "Usage: s3upload.sh <TemplateBucketName> <Environment> <LicenseFile>"
echo "For Example: ./s3upload.sh cf-templates-XXX-us-west-2 dev /Users/XXX/Downloads/XXX-customer1.yaml"
exit 1
else
S3_BUCKET=$1
S3_KEY_PREFIX=$2
LICENSE=$3
# upload license file to s3 bucket
cp $3 ./license/license.yaml
if [ $? -eq 0 ]; then
aws s3 cp ./license s3://$S3_BUCKET/$S3_KEY_PREFIX/license --recursive
rm ./license/license.yaml
fi
# Check if access to the bucket
if aws s3 ls "s3://$S3_BUCKET" 2>&1 | grep -q 'An error occurred'
then
echo "No access to S3 bucket: $S3_BUCKET !"
exit 1
fi
#aws s3 sync ./templates s3://$S3_BUCKET/$S3_KEY_PREFIX/templates
aws s3 sync ./templates s3://$S3_BUCKET/$S3_KEY_PREFIX/templates --exclude 'nested/amazon-eks/functions/source*'
aws s3 sync ./scripts s3://$S3_BUCKET/$S3_KEY_PREFIX/scripts
fi