-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_utils_layer.sh
More file actions
41 lines (31 loc) · 1.1 KB
/
Copy pathupdate_utils_layer.sh
File metadata and controls
41 lines (31 loc) · 1.1 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
37
38
39
40
41
#!/bin/bash
set -e
echo "开始更新 utils 层..."
# 创建临时目录
TEMP_DIR=$(mktemp -d)
echo "创建临时目录: $TEMP_DIR"
# 复制 utils 目录到临时目录
mkdir -p $TEMP_DIR/python
cp -r /home/ubuntu/environment/handsonoff-fargate/src/utils $TEMP_DIR/python/
# 进入临时目录并创建 zip 文件
cd $TEMP_DIR
zip -r utils_layer.zip python
# 获取 utils 层的 ARN
UTILS_LAYER_ARN=$(aws lambda list-layers --query "Layers[?LayerName=='DriverHandDetectionStack-utils-layer'].LatestMatchingVersion.LayerVersionArn" --output text)
if [ -z "$UTILS_LAYER_ARN" ]; then
echo "错误: 无法找到 utils 层"
exit 1
fi
echo "找到 utils 层: $UTILS_LAYER_ARN"
# 发布新版本的层
LAYER_NAME="DriverHandDetectionStack-utils-layer"
echo "发布新版本的 $LAYER_NAME 层..."
aws lambda publish-layer-version \
--layer-name $LAYER_NAME \
--description "Utils layer with updated parse_hands_on_result function" \
--zip-file fileb://utils_layer.zip \
--compatible-runtimes python3.12
echo "更新 utils 层完成"
# 清理临时目录
rm -rf $TEMP_DIR
echo "清理临时目录完成"