Home

Awesome

lambda-maven-plugin

Maven Central <br/>

Usage

group id: com.github.seanroy<br /> artifact id: lambda-maven-plugin<br /> version: 2.3.5<br /> <br/><br/> Please note that the artifact has been renamed from lambduh-maven-plugin to lambda-maven-plugin.

Deploy from command line

mvn package shade:shade lambda:deploy-lambda

Delete from command line

mvn lambda:delete-lambda

Configuration

All of the AWS Lambda configuration parameters may be set within the lambda plugin configuration or on the Maven command line using the -D directive.

mvn package shade:shade lambda:deploy-lambda -DpassThrough="{'KEY1' : 'VAL1', 'KEY2' : 'VAL2'}"

Current configuration of LambdaFunction can be found in LambdaFunction.java.

Example configuration in pom.xml

        <project

            ...

            <properties>
                <lambda.functionCode>${project.build.directory}/${project.build.finalName}.jar</lambda.functionCode>
                <lambda.version>${project.version}</lambda.version>
                <lambda.publish>true</lambda.publish>
                <lambda.forceUpdate>true</lambda.forceUpdate>
                <lambda.functionNameSuffix>dev</lambda.functionNameSuffix>
            </properties>

           ...

            <plugin>
                    <groupId>com.github.seanroy</groupId>
                    <artifactId>lambda-maven-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <skip>false</skip>
                        <functionCode>${lambda.functionCode}</functionCode>
                        <version>${lambda.version}</version>
                        <alias>development</alias>
                        <vpcSecurityGroupIds>sg-123456</vpcSecurityGroupIds>
                        <vpcSubnetIds>subnet-123456,subnet-123456,subnet-123456</vpcSubnetIds>
                        <lambdaRoleArn>arn:aws:iam::1234567:role/YourLambdaS3Role</lambdaRoleArn>
                        <s3Bucket>mys3bucket</s3Bucket>
                        <keyPrefix>my/awesome/prefix</keyPrefix>
                        <publish>${lambda.publish}</publish>
                        <forceUpdate>${lambda.forceUpdate}</forceUpdate>
                        <functionNameSuffix>${lambda.functionNameSuffix}</functionNameSuffix>
                        <environmentVariables>
                          <key0>value0</key0>
                        </environmentVariables>
                        <clientConfiguration>
                          <protocol>https</protocol>
                          <proxyHost>proxy-host.net</proxyHost>
                          <proxyPort>1234</proxyPort>
                        </clientConfiguration>
                        <lambdaFunctionsJSON>
                            [
                              {
                                "functionName": "my-function-name-0",
                                "description": "I am awesome function",
                                "handler": "no.flowlab.lambda0::test",
                                "timeout": 30,
                                "memorySize": 512,
                                "keepAlive": 15,
                                "triggers": [
                                  {
                                    "integration": "CloudWatch Events - Schedule",
                                    "ruleName": "every-minute",
                                    "ruleDescription": "foo bar",
                                    "scheduleExpression": "rate(1 minute)"
                                  },
                                  {
                                    "integration": "DynamoDB",
                                    "dynamoDBTable": "myTable",
                                    "batchSize": 100,
                                    "startingPosition": "TRIM_HORIZON"
                                  },
                                  {
                                    "integration": "Kinesis",
                                    "kinesisStream": "myStream",
                                    "batchSize": 100,
                                    "startingPosition": "TRIM_HORIZON"
                                  },
                                  {
                                    "integration": "SNS",
                                    "SNSTopic": "SNSTopic-1"
                                  },
                                  {
                                    "integration": "SNS",
                                    "SNSTopic": "SNSTopic-2"
                                  },
                                  {
                                    "integration": "Alexa Skills Kit"
                                    "alexaSkillId": "amzn1.ask.skill..."
                                  },
                                  {
                                    "integration": "Lex",
                                    "lexBotName": "BookCar"
                                  },
                                  {
                                    "integration": "SQS",
                                    "standardQueue": "queueName"
                                  }
                                ],
                                "environmentVariables": {
                                  "key1": "value1",
                                  "key2": "value2"
                                }
                              },
                              {
                                "functionName": "my-function-name-1",
                                "description": "I am awesome function too",
                                "handler": "no.flowlab.lambda1"
                              }
                            ]
                        </lambdaFunctionsJSON>
                    </configuration>
            </plugin>

            ...

        </project>

A Note About Environment Variables

Environment variables set by this plugin respect the following hierarchy:

  1. Variables set within the AWS Lambda Console.
  2. Variables set within the Configuration block of the plugin (See above).
  3. Variables set within the JSON lambda function descriptors (See above).
  4. Pass through variables defined on the command line when deploying the function.

Variables defined at a higher level (top of the list above) may be overridden by those at a lower level.

Credentials

Your AWS credentials may be set on the command line or in the plugin configuration. If accessKey and secretKey are not explicitly defined, the plugin will look for them in your environment or in your ~/.aws/credentials file

IAM permissions required by this plugin:

Developers

If you are interested in contributing to this project, please note that current development can be found in the SNAPSHOT branch of the coming release. When making pull requests, please create them against this branch.

A test harness has been provided which can be run with mvn test Please use this and feel free to add additional tests. Note that the basic-pom.xml file requires you to add your role arn in order to work. As such, basic-pom.xml has been added to .gitignore so that you don't accidentally commit your role to the file. If you add more pom's as part of enhancing the test suite, please remember to add them to .gitignore.

Releases

2.3.5

2.3.4

2.3.3

2.3.2

2.3.1

2.3.0

2.2.9

2.2.8

2.2.7

2.2.6

2.2.5

2.2.4

2.2.3

2.2.2

2.2.1

2.2.0

2.1.7

2.1.6

2.1.5

2.1.4

2.1.3

2.1.2

2.1.1

2.1.0

2.0.1

2.0.0

1.1.6

1.1.5

1.1.4

1.1.3

1.1.2

1.1.1

1.1.0

1.0.6

1.0.5

1.0.4

1.0.3

1.0.2