Skip to content

Commit cafa645

Browse files
committed
map layer arn instead of just version
1 parent 1b1b9fa commit cafa645

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bin/upload_cli_layer.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ for REGION in "${AWS_REGIONS[@]}"; do
4949
--action "lambda:GetLayerVersion" \
5050
--principal "*"
5151

52+
LAYER_ARN="arn:aws:lambda:${REGION}:${AWS_ACCOUNT_ID}:layer:${LAYER_NAME}:${LAYER_VERSION}"
53+
5254
echo "Lambda layer is now publicly accessible in region: $REGION!"
53-
echo "Layer ARN: arn:aws:lambda:${REGION}:${AWS_ACCOUNT_ID}:layer:${LAYER_NAME}:${LAYER_VERSION}"
55+
echo "Layer ARN: $LAYER_ARN"
5456

5557
# Store the mapping
56-
REGION_LAYER_MAP["$REGION"]="$LAYER_VERSION"
58+
REGION_LAYER_MAP["$REGION"]="$LAYER_ARN"
5759
done
5860

5961
# Update Lambda layer to Kosli cli mapping in the primary region (e.g., first region in the list)
@@ -70,8 +72,8 @@ aws s3 cp "s3://${S3_BUCKET}/${S3_KEY}" "$TEMP_FILE" --region "$PRIMARY_REGION"
7072
# Update the JSON file with mappings for all regions
7173
echo "Updating JSON file with new mappings..."
7274
for REGION in "${!REGION_LAYER_MAP[@]}"; do
73-
LAYER_VERSION=${REGION_LAYER_MAP[$REGION]}
74-
jq --arg binary "$TAG" --arg region "$REGION" --argjson layer "$LAYER_VERSION" '.[$binary][$region] = $layer' "$TEMP_FILE" > "${TEMP_FILE}.tmp" && mv "${TEMP_FILE}.tmp" "$TEMP_FILE"
75+
LAYER_ARN=${REGION_LAYER_MAP[$REGION]}
76+
jq --arg binary "$TAG" --arg region "$REGION" --arg layer "$LAYER_ARN" '.[$binary][$region] = $layer' "$TEMP_FILE" > "${TEMP_FILE}.tmp" && mv "${TEMP_FILE}.tmp" "$TEMP_FILE"
7577
done
7678

7779
# Validate the updated JSON file

0 commit comments

Comments
 (0)