Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lambda layer resource policy #34

Merged
merged 3 commits into from
Jun 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 44 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,62 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 1.22

# AMD Build
- name: Build AMD ZIP File
working-directory: ./logzio-lambda-extensions-logs
run: ./build-zip.sh
- name: Setup AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ matrix.aws-region }}
- name: Deploy Layer to AWS region ${{ matrix.aws-region }}
# AMD Build
- name: Build AMD ZIP File
working-directory: ./logzio-lambda-extensions-logs
run: ./build-zip.sh
- name: Publish AMD64 Layer Version
working-directory: ./logzio-lambda-extensions-logs/bin
run: |
LAYER_VERSION=$(aws lambda publish-layer-version \
--layer-name LogzioLambdaExtensionLogs \
--description "Extension for shipping Lambda logs to Logz.io ${{ github.event.release.tag_name }}." \
--zip-file "fileb://extension.zip" \
--region ${{ matrix.aws-region }} \
--compatible-runtimes dotnet8 python3.12 provided.al2023 dotnet6 java11 java17 java8.al2 nodejs16.x nodejs18.x python3.10 python3.11 python3.8 python3.9 ruby3.2 provided.al2 \
--compatible-architectures x86_64 \
--output text --query 'Version')
echo "Layer Version: $LAYER_VERSION" # Save the version for next step
- name: Grant Public GetLayerVersion Permission for AMD64
working-directory: ./logzio-lambda-extensions-logs/bin
run: |
aws lambda publish-layer-version \
--layer-name LogzioLambdaExtensionLogs \
--description "Extension for shipping Lambda logs to Logz.io ${{ github.event.release.tag_name }}." \
--zip-file "fileb://extension.zip" \
--region ${{ matrix.aws-region }} \
--compatible-runtimes dotnet8 python3.12 provided.al2023 dotnet6 java11 java17 java8.al2 nodejs16.x nodejs18.x python3.10 python3.11 python3.8 python3.9 ruby3.2 provided.al2 \
--compatible-architectures x86_64
aws lambda add-layer-version-permission \
--layer-name LogzioLambdaExtensionLogs \
--version-number ${{ steps.publish.outputs.LAYER_VERSION }} \
--statement-id public-access-statement \
--principal '*' \
--action lambda:GetLayerVersion \
--region ${{ matrix.aws-region }}

# ARM Build
- name: Build ARM ZIP File
working-directory: ./logzio-lambda-extensions-logs
run: chmod +x ./build-arm-zip.sh
- name: Deploy ARM Layer to AWS region ${{ matrix.aws-region }}
- name: Publish ARM64 Layer Version
working-directory: ./logzio-lambda-extensions-logs/bin
run: |
LAYER_VERSION=$(aws lambda publish-layer-version \
--layer-name LogzioLambdaExtensionLogsArm \
--description "Extension for shipping Lambda logs to Logz.io ${{ github.event.release.tag_name }}, for arm64 architecture.." \
--zip-file "fileb://extension.zip" \
--region ${{ matrix.aws-region }} \
--compatible-runtimes dotnet8 python3.12 provided.al2023 dotnet6 java11 java17 java8.al2 nodejs16.x nodejs18.x python3.10 python3.11 python3.8 python3.9 ruby3.2 provided.al2 \
--compatible-architectures arm64 \
--output text --query 'Version')
echo "Layer Version: $LAYER_VERSION" # Save the version for next step
- name: Grant Public GetLayerVersion Permission
working-directory: ./logzio-lambda-extensions-logs/bin
run: |
aws lambda publish-layer-version \
--layer-name LogzioLambdaExtensionLogsArm \
--description "Extension for shipping Lambda logs to Logz.io $ {{ github.event.release.tag_name }}, for arm64 architecture." \
--zip-file "fileb://extension.zip" \
--region ${{ matrix.aws-region }} \
--compatible-runtimes dotnet8 python3.12 provided.al2023 dotnet6 java11 java17 java8.al2 nodejs16.x nodejs18.x python3.10 python3.11 python3.8 python3.9 ruby3.2 provided.al2 \
--compatible-architectures arm64
aws lambda add-layer-version-permission \
--layer-name LogzioLambdaExtensionLogsArm \
--version-number ${{ steps.publish.outputs.LAYER_VERSION }} \
--statement-id public-access-statement \
--principal '*' \
--action lambda:GetLayerVersion \
--region ${{ matrix.aws-region }}
Loading