lambda-layer-git
Add git binaries to AWS Lambda layer.
Deprecation Notice
Consider using git-lambda-layer instead, as it is compatible with all AWS runtimes (languages).
If you prefer to run git in a layer you have visibility (control) into run the following commands:
git clone https://github.com/lambci/git-lambda-layer.git./publish.sh
In case you are using the serverless
framework, your git
lambda layer can be created by using a serverless.yml
file with the following contents:
service: git-lambda-layerprovider: name: aws region: us-east-1 layers: git: path: ../git-lambda-layer # using '.' clips first 2 characters description: Add git binaries to your lambda function licenseInfo: MIT allowedAccounts: - 'YOUR_AWS_ACCOUNT_ID' # use '*' to give permission to all AWS accounts package: artifact: layer.zip
Once your Lambda layer is created, it should be referenced in your lambda function.
Overview
This module allows loading git
(version 2.13.5) as an AWS Lambda Layer so it can be used within you Lambda function (e.g. through simple-git
).
Install
$ npm install --save lambda-layer-git
git
AWS Lambda Layer git
layer
Manually creating your own For security, traceability, or other reasons it might be preferable to deploy your own git
Lambda layer.
Your git
lambda layer can be created manually by:
-
Compressing (zipping) the following folders/files:
- bin
- nodejs
- LICENSE
- README.md
-
Using the AWS CLI or AWS console to create your lambda layer and upload the zip file created in the previous step.
serverless
to create your own git
layer
Using In case you are using the serverless
framework, your git
lambda layer can be created by using a serverless.yml
file with the following contents:
service: lambda-layer-gitprovider: name: aws region: us-east-1 layers: git: path: ../lambda-layer-git # using '.' clips first 2 characters description: Add git binaries to your lambda function (git v2.13.5) compatibleRuntimes: - nodejs4.3 - nodejs6.10 - nodejs8.10 licenseInfo: MIT allowedAccounts: - 'YOUR_AWS_ACCOUNT_ID' # use '*' to give permission to all AWS accounts package: exclude: - ./** include: - bin/** - nodejs/** - LICENSE - README.md
Using
Once your Lambda layer is created, it should be referenced in your lambda function.
Invoke the lambda-layer-git
module as follows:
;