Simple gulp plugin for deploying stack files to AWS cloudformation
This module will WAIT until the deployment is entirely finished before completing the task. Useful if you want to ensure the deployment is complete before running other gulp tasks.
gulpfile.js
var gulp = require('gulp')
var cloudformation = require('gulp-cloudformation')
gulp.task('stack', () => {
return gulp.src(['location/to/[name-of-stack-file].json'])
.pipe(cloudformation.init({ //Only validates the stack files
region: 'us-east-1',
accessKeyId: 'YOUR AWS ACCESS KEY ID',
secretAccessKey: 'YOUR AWS SECRET ACCESS KEY'
}))
.pipe(cloudformation.deploy({ //deploy stack files
Capabilities: [ 'CAPABILITY_IAM' ] //needed if deploying IAM Roles
StackName: 'SomeStack' // Optional: defaults to the name of the stack file
}))
.on('error', (error) => {
util.log('Stream Exiting With Error', error)
throw error
})
})
The source is available for download from GitHub
For node js, you can install using Node Package Manager npm
npm install gulp-cloudformation
In node js:
var cloudformation = require('gulp-cloudformation')