Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const gulp = require('gulp');
const zip = require('gulp-zip');
const lambda = require('node-aws-lambda');
const config = {
region: 'ap-northeast-1',
handler: 'index.handler',
functionName: 'gulp',
role: 'arn:aws:iam::xxxxxxxxxxxx:role/service-role/test-gulp-xxxx', // 再デプロイ時は省略可能
runtime: 'nodejs12.x'
};
gulp.task('zip', function() {
return gulp.src(['lambda/**/*', '!lambda/package.json', '!lambda/package-lock.json'])
.pipe(zip('./lambda.zip'))
.pipe(gulp.dest('./'));
});
gulp.task('upload',function(callback) {
config.functionName = 'test-' + config.functionName; // 引数渡してプレフィックスつけたい(test-,prod-,...)
lambda.deploy('./lambda.zip', config, callback);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.