Lambda Requirements

When in Rome do as the Romans

We believe developers of lambdas should feel like in home while writing them in their languages. We are not going to come up with a package manager for javascript or a build tool for java better than the existing ones.

For that reason we try to respect as much as possible each runtime de facto package managers / build tools.

That is the reason why the default build implementation for each kind of runtime uses pip, npm and graddle. If you want to know more about the build property of lambdas you can read Lambda: build.

Note

For using this functionality, you’ll need to make the code path for you lambda be a directory. For more information you can read the code section in Lambdas.

Python requirements

If your python lambda requires some python packages, you can create a requirements.txt file in the root of your lambda folder, and gordon will install all those using pip.

For more information about the format of this file:

Additionally you can customize how gordon invoques pip using the following settings:

Setting Description
pip-path Path to you pip binary Default: pip
pip-install-extra Extra arguments you want gordon to use while invoking pip install.

Example requirements.txt:

requests>=2.0
cfn-response

Javascript requirements

If your javascript lambda requires some extra modules, you can create a package.json file in the root of your lambda folder, and gordon will invoke npm install for you.

For more information:

Additionally you can customize how gordon invoques npm using the following settings:

Setting Description
npm-path Path to you npm binary Default: npm
npm-install-extra Extra arguments you want gordon to use while invoking npm install.

Example package.json:

{
  "dependencies": {
    "path": "0.11.14"
  }
}

Java requirements

If your Java lambda requires some extra packages, you can customize how your Java lambda is built editing your dependency section in your build.gradle file.

For more information:

The only requirement gordon enforces to this build.gradle file is that the build target leaves whatever you want to get bundled into your lambda in the dest folder. You can make this build process as complex as you want/need.

Additionally you can customize how gordon invoques gradle using the following settings:

Setting Description
gradle-path Path to you gradle binary Default: gradle
gradle-build-extra Extra arguments you want gordon to use while invoking gradle build.

Example build.grandle:

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile (
        'com.amazonaws:aws-lambda-java-core:1.1.0',
        'com.amazonaws:aws-lambda-java-events:1.1.0'
    )
}

task buildLambda(type: Copy) {
    from compileJava
    from processResources
    into('lib') {
        from configurations.runtime
    }
    into target
}

build.dependsOn buildLambda