Skip to content

Commit

Permalink
make it work without docker-compose
Browse files Browse the repository at this point in the history
Signed-off-by: Elliot Murphy <[email protected]>
  • Loading branch information
statik committed Apr 9, 2019
1 parent f17e5a0 commit 37f86f1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# lambda-clamav-layer
an AWS Lambda Layer with clamav binaries


## building a fresh layer

To generate the layer, run

docker-compose run layer
Expand All @@ -13,6 +16,33 @@ To inspect the contents of the zipfile, run

unzip -vl build/lambda_layer.zip

To publish the lambda layer, run:
## Publishing the layer to your AWS environment

For convenience, a prebuilt zip is published as a github release for this
project, you can download it from the releases page.

To publish the lambda layer, first upload it to S3 using a command like this:




Then create a layer version, specifying the zip file:

aws lambda publish-layer-version --layer-name clamav-antivirus \

To grant permissions to all accounts inside your organization to use the layer,
use these commands.

First, find your organization ID:

aws organizations describe-organization

Next, add a permission grant for this organization:

TODO
aws lambda add-layer-version-permission \
--layer-name clamav-antivirus \
--version-number 1 \
--statement-id allOrganizationAccounts \
--principal * \
--action lambda:GetLayerVersion \
-- organization-id o-NNN
4 changes: 4 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ set -e

echo "prepping clamav"

rm -rf bin
rm -rf lib
rm lambda_layer.zip

yum update -y
amazon-linux-extras install epel -y
yum install -y cpio yum-utils zip
Expand Down
5 changes: 5 additions & 0 deletions dockerbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e
docker pull amazonlinux:2
docker run --rm -ti -v `pwd`/build:/opt/app amazonlinux:2 /bin/bash -c "cd /opt/app && ./build.sh"

0 comments on commit 37f86f1

Please sign in to comment.