Skip to content

fossabot/lambda-layer-git

 
 

Repository files navigation

lambda-git

NPM Version Codacy Badge Known Vulnerabilities FOSSA Status

Add git binaries to AWS Lambda layer.

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

AWS Lambda Layer git

Manually creating your own git layer

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.

Using serverless to create your own git layer

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-git
provider:
  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 a Lambda layer is created, it should be referenced in your lambda function.

Invoke the lambda-layer-git module as follows:

require("lambda-layer-git").prepareGit()
	.then(function () {
		// git is now ready
    // exec("git --version");
	})
	.catch(function (error) {
		// something failed
	});

About

Add git binaries to AWS Lambda layer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 74.4%
  • Perl 24.9%
  • JavaScript 0.7%