-
Notifications
You must be signed in to change notification settings - Fork 53
/
deploy.sh
executable file
·56 lines (51 loc) · 1.39 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
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
#!/bin/bash
set -euo pipefail
if [[ -z ${1+x} ]];
then
echo 'version number required'
exit 1
else
VERSION=$1
fi
function releaseToRegion {
version=$1
region=$2
bucket="aws-lambda-r-runtime.$region"
echo "publishing layers to region $region"
sam package \
--output-template-file packaged.yaml \
--s3-bucket ${bucket} \
--s3-prefix R-${version} \
--region ${region}
version_="${version//\./_}"
stack_name=r-${version//\./-}
sam deploy \
--template-file packaged.yaml \
--stack-name ${stack_name} \
--parameter-overrides Version=${version_} \
--no-fail-on-empty-changeset \
--region ${region} \
--capabilities CAPABILITY_IAM
layers=(runtime recommended awspack)
echo "Published layers:"
aws cloudformation describe-stack-resources \
--stack-name ${stack_name} \
--query "StackResources[?ResourceType=='AWS::Lambda::LayerVersion'].PhysicalResourceId" \
--region ${region}
}
regions=(
us-east-1 us-east-2
us-west-1 us-west-2
ap-south-1
ap-northeast-1 ap-northeast-2
ap-southeast-1 ap-southeast-2
ca-central-1
eu-central-1
eu-north-1
eu-west-1 eu-west-2 eu-west-3
sa-east-1
)
for region in "${regions[@]}"
do
releaseToRegion ${VERSION} ${region}
done