forked from PDAL/lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-lambda-layer.sh
More file actions
executable file
·37 lines (27 loc) · 1.08 KB
/
Copy pathcreate-lambda-layer.sh
File metadata and controls
executable file
·37 lines (27 loc) · 1.08 KB
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
LAYERNAME="pdal"
LAYER=$(aws lambda publish-layer-version \
--layer-name $LAYERNAME \
--description "PDAL 1.9.1 softare" \
--zip-file fileb://./lambda-deploy.zip \
--compatible-runtimes "provided" \
--license-info BSD \
--region $AWS_REGION \
--profile $AWS_PROFILE)
VERSION=$(aws lambda list-layers --region $AWS_REGION |jq '.Layers[]| select(.LayerName=="'$LAYERNAME'").LatestMatchingVersion.Version' -r)
echo "Published version $VERSION for Lambda layer $LAYERNAME"
LAYER=$(aws lambda get-layer-version \
--layer-name pdal \
--version-number $VERSION \
--region $AWS_REGION \
--profile $AWS_PROFILE)
echo "Setting execution access to public for version $VERSION for Lambda layer $LAYERNAME"
PERMISSION=$(aws lambda add-layer-version-permission \
--layer-name pdal \
--version-number $VERSION \
--statement-id "run-pdal-publicly" \
--principal '*' \
--action lambda:GetLayerVersion \
--region $AWS_REGION \
--profile $AWS_PROFILE )
LAYERARN=$(echo $LAYER | jq -r .LayerArn)
echo "Layer $LAYERNAME is available at '$LAYERARN'"