All Projects → jacksgt → lambda-layer-tool

jacksgt / lambda-layer-tool

Licence: MIT License
Build and publish AWS Lambda layers defined in YAML

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to lambda-layer-tool

py-lambda-action
A Github Action to deploy AWS Lambda functions written in Python with their dependencies in a separate layer.
Stars: ✭ 49 (+122.73%)
Mutual labels:  lambda, lambda-layer
Bref
Serverless PHP on AWS Lambda
Stars: ✭ 2,382 (+10727.27%)
Mutual labels:  lambda, lambda-layer
cerberus-serverless-components
A collection of AWS Serverless components for Cerberus
Stars: ✭ 12 (-45.45%)
Mutual labels:  lambda
ruby-vips-lambda
AWS Lambda Layer for Ruby Libvips Gem
Stars: ✭ 34 (+54.55%)
Mutual labels:  lambda-layer
aws lambda ftp function
AWS Lambda Function to connect to FTP, download files and save them to S3 bucket
Stars: ✭ 55 (+150%)
Mutual labels:  lambda
spring-boot-lambda
No description or website provided.
Stars: ✭ 44 (+100%)
Mutual labels:  lambda
aws-pipeline
Build a CI/CD for Microservices and Serverless Functions in AWS ☁️
Stars: ✭ 32 (+45.45%)
Mutual labels:  lambda
serverless-contact-form
Email contact form using the Serverless framework on AWS Lambda
Stars: ✭ 39 (+77.27%)
Mutual labels:  lambda
node10-express-template
Node.js 10 Express Template for OpenFaaS
Stars: ✭ 26 (+18.18%)
Mutual labels:  lambda
instance-watcher
Get notified for Instances mistakenly left running across all AWS regions for specific AWS Account
Stars: ✭ 90 (+309.09%)
Mutual labels:  lambda
lambda-cron
LambdaCron - serverless cron tool
Stars: ✭ 22 (+0%)
Mutual labels:  lambda
s3-lambda-transcribe-audio-to-text-s3
Transcribe your audio to text with this serverless component
Stars: ✭ 84 (+281.82%)
Mutual labels:  lambda
extract-css
Extract all CSS from a webpage, packaged as a Now V2 Lambda
Stars: ✭ 23 (+4.55%)
Mutual labels:  lambda
lambda-string
Lambda-string (LS) is a helping java agent that inject configurable toString method into lambdas with some useful meta-information.
Stars: ✭ 34 (+54.55%)
Mutual labels:  lambda
zero-administration-inference-with-aws-lambda-for-hugging-face
Zero administration inference with AWS Lambda for 🤗
Stars: ✭ 19 (-13.64%)
Mutual labels:  lambda
buildkite-agent-scaler
📈A lambda for scaling an AutoScalingGroup based on Buildkite metrics
Stars: ✭ 25 (+13.64%)
Mutual labels:  lambda
herman
Herman is a tool to simplify deployment of AWS Services using ECS and Lambda, and the provisioning of various AWS services.
Stars: ✭ 33 (+50%)
Mutual labels:  lambda
example-step-functions-integration-api-gateway
Example application using the new Step Functions integration with API Gateway. It developers to call API Gateway REST APIs and API Gateway from a Step Functions workflow.
Stars: ✭ 17 (-22.73%)
Mutual labels:  lambda
zappa-blog
A blog about Zappa, powered by Zappa. Zappa zappa zappa. Zappa.
Stars: ✭ 17 (-22.73%)
Mutual labels:  lambda
ebsautotagger
AWS Lambda function to tag EBS volumes created by autoscaling
Stars: ✭ 18 (-18.18%)
Mutual labels:  lambda

Lambda Layer Tool

Build status

A tool to programmatically build and publish Layers for AWS Lambda.

Instead of manually copy & pasting build instructions for a Lambda Layer into your shell or trying to script your way around, use this tool to automate the process. Given a simple YAML file, it will:

  • create a new, clean directory for the lambda layer,
  • run specified pre-installation commands,
  • Python: install requirements with Pip in a virtual environment,
  • Node.js: install dependencies with NPM,
  • strip any binaries and libraries in the lambda directory,
  • apply global and layer-specific exclusion patterns,
  • bundle the remainder up into a ZIP archive.

Then, you can use the tool to publish the new layer (version) on AWS.

For a full introduction, read the introductory blog post.

Here is a simple example:

---
version: '0.3'
default_excludes:
  - '*.dist-info/*'
  - '*.egg-info/*'
  - '*/__pycache__/*'
  - '*.pyc'
layers:
  awesome-numpy:
    description: 'Minimal numpy 1.18'
    runtimes: 'python3.6'
    pre_installs:
      - 'yum install gcc-gfortran'
    requirements:
      - 'numpy==1.18.2'
    excludes:
      - '*/numpy/tests/*'

Then just run:

$ ./layer-tool.py --build awesome-numpy
[...]

$ du -h awesome-numpy.zip
13M

$ ./layer-tool.py --publish awesome-numpy
{
    "Content": {
        "Location": "https://example.com/aws",
        "CodeSha256": "xxQC6FDxg63M5m2UL2cXmChD+dFX7fp61LRrrqmVjGY=",
        "CodeSize": 13590501
    },
    "LayerArn": "arn:aws:lambda:$AWS_REGION:$AWS_ID:layer:awesome-numpy",
    "LayerVersionArn": "arn:aws:lambda:$AWS_REGION:$AWS_ID:layer:awesome-numpy:1",
    "Description": "Minimal numpy 1.18 for python3.7",
    "CreatedDate": "2020-03-28T07:40:49.714+0000",
    "Version": 1,
    "CompatibleRuntimes": [
        "python3.7"
    ]
}

To learn how to use this tool to reduce the size of your layers, read the post about creating a minimal boto3 layer.

The tests directory also serve as examples how to build layers for different runtimes (Python, Node.js).

Lambda Environment

To match the environment of AWS Lambda functions as closely as possible (especially when you use this tool on non-Linux systems), the tool should be run inside a Docker container. The lambci/lambda Docker image closely resembles the real Lambda environment and is well-suited for this task. Example:

docker run --rm -v "$PWD:/var/task" lambci/lambda:build-python3.7 ./layer-tool.py --build awesome-numpy

Publishing

Publishing assumes you have previously configured the aws-cli to connect to your AWS account.

Note: Publishing always creates a new version of your layer. For more information see https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html .

Dependencies

In addition to the Python dependencies (requirements.txt), this tool currently needs the following command line tools:

  • aws-cli (aws)
  • find
  • zip

Limitations

Currently, this tool only supports building Python layers with Pip and Node.js layer with NPM. However, it should be fairly straightforward to extend the functionality to other runtimes and package managers.

License

This software is license under the MIT License. See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].