diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7161c8e..6bc3432 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,14 +36,30 @@ First of all, thanks for contributing!. Before contributing please read the [COD Add the layer arn generated from build command output to your lambda function by following instructions in [docs](https://help.sumologic.com/03Send-Data/Collect-from-Other-Data-Sources/Collect_AWS_Lambda_Logs_using_an_Extension).Test by running the function manually. Confirm that logs are coming to Sumo Logic. ## Releasing the layers - 1. Change the *AWS_PROFILE* environment variable using below command. The profile should point to sumocontent aws account. - `export AWS_PROFILE=` - 1. Update the layer version in *config/version.go*. - 1. Go to scripts folder - `cd scripts/` - 1. Change the layer_name variable in zip.sh to avoid replacing the prod. - 1. Run below command - `sh zip.sh` + +### Notes on AWS Lambda Layer Versions +- Lambda **layer versions are immutable**. + - Once a version (e.g., `v10`) is published, its code and content cannot be modified. + - If changes are needed, you must publish a **new version** (e.g., `v11`). + +- Once you **delete a Lambda layer version** (like `v10`), it’s permanently gone. + - You cannot reuse or re-publish that same version number. + - Any new Lambda function or update trying to reference `v10` will fail. + +- Existing Lambda functions that were already using `v10` may still run for a while, + because AWS caches the layer code internally. + - However, once you update or redeploy them, `v10` will no longer be available. + +1. Change the *AWS_PROFILE* environment variable using below command. The profile should point to sumocontent aws account. + `export AWS_PROFILE=` +1. Update the layer version in *config/version.go*. +1. Go to scripts folder + `cd scripts/` +1. Change the layer_name variable in zip.sh to avoid replacing the prod. +1. Run the following command to publish the layer: + `sh zip.sh` +1. Run the following command to verify that the layer version is published across regions: + `sh verify_layer_versions.sh` ### Github Release diff --git a/containerimageexample/python-arm64/Dockerfile b/containerimageexample/python-arm64/Dockerfile index 8fc87cd..e613bc1 100644 --- a/containerimageexample/python-arm64/Dockerfile +++ b/containerimageexample/python-arm64/Dockerfile @@ -39,10 +39,14 @@ WORKDIR ${FUNCTION_DIR} COPY --from=build-image ${FUNCTION_DIR} ./ # (Optional) Add Lambda Runtime Interface Emulator and use a script in the ENTRYPOINT for simpler local runs ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie /usr/bin/aws-lambda-rie -# Create the directory explicitly +# Create the target directory for extensions RUN mkdir -p /opt/extensions -# SumoLogic Lambda extension -COPY extensions/sumologic-extension /opt/extensions/ + +# Extract the Sumo Logic Lambda extension package +ADD sumologic-extension-arm64.tar.gz /opt/extensions/ + +# Clean up any hidden files from the extracted content +RUN find /opt/extensions -type f -name ".*" -delete COPY entry.sh / RUN chmod 755 /usr/bin/aws-lambda-rie /entry.sh ENTRYPOINT [ "/entry.sh" ] diff --git a/containerimageexample/python-arm64/extensions/sumologic-extension b/containerimageexample/python-arm64/extensions/sumologic-extension deleted file mode 100755 index 2b7b216..0000000 Binary files a/containerimageexample/python-arm64/extensions/sumologic-extension and /dev/null differ diff --git a/containerimageexample/python-arm64/sumologic-extension-amd64.tar.gz b/containerimageexample/python-arm64/sumologic-extension-amd64.tar.gz index 1f040be..f2d83f0 100644 Binary files a/containerimageexample/python-arm64/sumologic-extension-amd64.tar.gz and b/containerimageexample/python-arm64/sumologic-extension-amd64.tar.gz differ diff --git a/containerimageexample/python-arm64/sumologic-extension-arm64.tar.gz b/containerimageexample/python-arm64/sumologic-extension-arm64.tar.gz index df5d059..0a58d59 100644 Binary files a/containerimageexample/python-arm64/sumologic-extension-arm64.tar.gz and b/containerimageexample/python-arm64/sumologic-extension-arm64.tar.gz differ diff --git a/scripts/zip.sh b/scripts/zip.sh old mode 100644 new mode 100755 index abf794c..4d2d0ab --- a/scripts/zip.sh +++ b/scripts/zip.sh @@ -40,8 +40,8 @@ for arch in "${ARCHITECTURES[@]}"; do echo "Creating the Zip file binary in extension folder." cd "${TARGET_DIR}/${arch}" - zip -r "zip/${binary_name}.zip" extensions/ - tar -czvf "zip/${binary_name}-${arch}.tar.gz" extensions/ + zip -j "zip/${binary_name}.zip" "extensions/${binary_name}" + tar -czvf "zip/${binary_name}-${arch}.tar.gz" -C extensions "${binary_name}" status=$? if [ $status -ne 0 ]; then echo "Zip Generation Failed"