Package Exports
- gulp-awslambda
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-awslambda) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gulp-awslambda
A Gulp plugin for publishing your package to AWS Lambda
Install
$ npm install --save-dev gulp-awslambdaUsage
AWS Credentials
It is recommended that you store your AWS Credentials in ~/.aws/credentials as per the docs.
Basic Workflow
gulp-awslambda accepts a single ZIP file, uploads that to AWS Lambda, and passes it on down the stream. It works really well with gulp-zip:
var gulp = require('gulp');
var lambda = require('gulp-awslambda');
var zip = require('gulp-zip');
gulp.task('default', function() {
return gulp.src('index.js')
.pipe(zip('archive.zip'))
.pipe(lambda(lambda_params, opts))
.pipe(gulp.dest('.'));
});For more information on lambda_params and opts see the API section.
Example Project
See the example/ directory of this repo for a full working example.
API
lambda(lambda_params, opts)lambda_params
Parameters describing the Lambda function. This can either be...
A String
corresponding to the name of an existing Lambda function. In this case gulp-awslambda will automatically download its configuration and use it to upload changes.
An Object
that is exactly the same as you would pass to uploadFunction() minus the FunctionZip property. The only required parameters are FunctionName and Role. All the other parameters have the following default values:
Handler = 'index.handler': This assumes a validexports.handlerinindex.jsat the root of your ZIPMode = 'event': Currently the only supported modeRuntime = 'nodejs': Currently the only supported runtime
opts
Options configuring the AWS environment to be used when uploading the function. The following options are supported:
profile
If you use a different credentials profile, you can specify its name with this option.
region = 'us-east-1'
Set your AWS region.