generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·27 lines (22 loc) · 861 Bytes
/
run.sh
File metadata and controls
executable file
·27 lines (22 loc) · 861 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
#!/bin/bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
EXTENSION_NAME=$1
LAMBDA_FUNCTION=$2
# Build artifacts
mvn clean install
# Create zip
chmod +x extensions/java-example-extension
archive="extension.zip"
if [ -f "$archive" ] ; then
rm "$archive"
fi
zip "$archive" -j target/java-example-extension-1.0-SNAPSHOT.jar
zip "$archive" extensions/*
# Push extension
aws lambda publish-layer-version --layer-name "${EXTENSION_NAME}" --zip-file "fileb://$archive"
# Update Lambda function to the latest version of external pushed as Lambda layers
aws lambda update-function-configuration \
--function-name ${LAMBDA_FUNCTION} --layers $(aws lambda list-layer-versions --layer-name ${EXTENSION_NAME} \
--max-items 1 --no-paginate --query 'LayerVersions[0].LayerVersionArn' \
--output text)