• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

willyg302/gulp-awslambda: A Gulp plugin for publishing your package to AWS Lambd ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

willyg302/gulp-awslambda

开源软件地址(OpenSource Url):

https://github.com/willyg302/gulp-awslambda

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-awslambda

Travis license

A Gulp plugin for publishing your package to AWS Lambda

Install

$ npm install --save-dev gulp-awslambda

Usage

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 only update the function's code.

An Object

that is mostly the same as you would pass to updateFunctionConfiguration(). The only required parameters are FunctionName and Role. All the other parameters have the following default values:

  • Handler = 'index.handler': This assumes a valid exports.handler in index.js at the root of your ZIP
  • Runtime = 'nodejs4.3': Also accepts 'nodejs' and 'nodejs6.10'

gulp-awslambda will perform an upsert, meaning the function will be created if it does not already exist, and updated (both code and configuration) otherwise.

For code, gulp-awslambda will default to passing the ZipFile property. However, you may alternatively pass e.g.:

Code: {
	S3Bucket: 'myBucket',
	S3Key: 'function.zip',
},
...

to upload from S3.

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.

publish

Allows you to publish a new version when passing in a string for lambda_params. Otherwise, you may simply specify Publish as a parameter. If both are provided, the value in lambda_params will take precedence.

region = 'us-east-1'

Set your AWS region.

alias

Requires publish=true. Creates an alias for the version being published. If the alias already exists, it is updated to point to the version being published. Alternate versions may be specified. The following options are supported:

name

Required string. The name of the alias.

description

Optional text to describe the function's version alias.

version

Optional version number to which to assign the alias. If not specified, the alias will be assigned to the version just published.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap