AWS Lambda0.5.10Minimum Jenkins requirement: 1.580.1ID: aws-lambda
This plugin adds AWS Lambda invocation and deployment abilities to build steps and post build actions
Currently the plugin can deploy and invoke functions as a build step and post build action. When invoking a function it is possible to inject the output as Jenkins environment variables.
Github link: https://github.com/XT-i/aws-lambda-jenkins-plugin
Jenkins wiki link: https://wiki.jenkins-ci.org/display/JENKINS/AWS+Lambda+Plugin
Look for the AWS Lambda plugin in the available plugins after clicking "manage jenkins" and "manage plugins".
For deployment you'll need access to the GetFunction, CreateFunction, UpdateFunctionCode and UpdateFunctionConfiguration Lambda commands.
You'll also need access to iam:PassRole to attach a role to the Lambda function.
For invocation you only need access to InvokeFunction.
AWS Lambda function deployment
After creating a job you can add a build step or post build action to deploy an AWS Lambda function.
Due to the fact that AWS Lambda is still a rapid changing service we decided not to have select boxes for input.
The AWS Access Key Id, AWS Secret Key, region and function name are always required. All other fields depend on the update mode.
If the update mode is Code you also need to add the location of a zipfile or folder.
Folders are automatically zipped according to the AWS Lambda documentation
You can also choose to deploy a function already on S3, if the bucket is in the same region as the Lambda function.
For the Configuration update mode you need the role and handler. If you want to diverge from the defaults add the memory and timeout values.
When choosing the Both update mode, both UpdateFunctionCode and UpdateFunctionConfiguration are performed.
If the function has not been created before the plugin will try to do a CreateFunction call, which needs all fields previously mentioned in addition to the runtime value.
The update mode value is ignored if the function does not exists yet, but it will take effect in future builds.
AWS Lambda function invocation
To invoke a function once again open up the add build step or post build action menu.
You need to add the AWS Access Key Id, AWS Secret key, region and function name. Optionally you can add a payload that your function expects.
If you enable the Synchronous checkbox you will receive the response payload that can be parsed using the Json Parameters.
You will also get the logs from Lambda into your Jenkins console output.
The json parameters allow you to parse the output from the lambda function. The parsed value will then be injected into the Jenkins environment using the chosen name.
An empty jsonPath field allows you to inject the whole response into the specified environment variable.
$.key1 => value1
$.array1.arraykey => arrayvalue2
These environment variables can be used as parameters in further build steps and actions which allow a Lambda function to have a deciding factor in the deployment process.
Job build result
On the job build result page you'll get a summary of all deployed and invoked functions and their success state.