gulp-aws-stepfunctions-deploy

0.2.1 • Public • Published

gulp-aws-stepfunctions-deploy

Version 0.2.1

Build Status

NPM

Package version history

This package uses the aws-sdk (node).

NPM

Install

npm install gulp-aws-stepfunctions-deploy

Usage

Including + Setting Up Config

    var gulp = require('gulp');
    var aws-sf = require('gulp-aws-stepfunctions-deploy')(config);

...where config is something like...

var config = {
    accessKeyId: "YOURACCESSKEY",
    secretAccessKey: "YOUACCESSSECRET"
}
 
//  ...or...
 
var config = JSON.parse(fs.readFileSync('private/awsaccess.json'));
 
//  ...or to use IAM settings...
 
var config = { useIAM: true };
 
// ...or to use IAM ...
 
var awssf = require('gulp-aws-stepfunctions-deploy')(
    {useIAM:true},
);
 
// or {} / null
 

The optional config argument can include any option available (like region) available in the AWS Config Constructor. By default all settings are undefined.

Per AWS best practices, the recommended approach for loading credentials is to use the shared credentials file (~/.aws/credentials). You can also set the aws_access_key_id and aws_secret_access_key environment variables or specify values directly in the gulpfile via the accessKeyId and secretAccessKey options.

If you want to use an AWS profile in your ~/.aws/credentials file just set the environment variable AWS_PROFILE with your profile name before invoking your gulp task:

AWS_PROFILE=myprofile gulp upload

If you are using IAM settings, just pass the noted config ({useIAM:true}) in order to default to using IAM. More information on using IAM settings here.

Feel free to also include credentials straight into your gulpfile.js, though be careful about committing files with secret credentials in your projects!

Having AWS Key/Secrets may not be required by your AWS/IAM settings. Errors thrown by the request should give your permission errors.

Gulp Task

Create a task.

gulp.task("deploy-step-function", () => {
    return gulp.src("./dir/with/step_functions/*.json")
        .pipe(awssf({}))
    .on( "end", function() { 
            console.log('end ');
        })
    .on( "error", function( err ) {
        console.log( err );
    })
 
    ;
});

Step Function files

json file format following:

{
  "function_name": "step-function-parallel",
  "recreate": false,
  "role_arn" : "StatesExecutionRole-eu-west-1",
  "function_body": {
      ...
  }
}

More samples here

Options

role_arn (optional)

Type: string

Set IAM Roled under which function executes. You can either specify desired IAM Role and omit to use pre-created StatesExecutionRole-${gconfig.region}

function_name (required)

Type: string

Step Function name.

recreate (optional)

Type: bool

If set, check existence, stop all running instances and remove function with name specified, before create new one. If not set, update existent function or create if absent. Default is false.

function_body (optional)

Type: string

Function body content

Be aware that "function_name", "role_arn", "function_body" can have pieces with ES6 template string mechanism (see http://es6-features.org/#StringInterpolation). This can be used for string customization via different substituions (for instance, using Environment Variables) Sample: "role_arn" : "StatesExecutionRole-eu-${required('process').env.AWS_REGION}", Some interesting customization can be done in "function_body" as well.

gulp-aws-stepfunctions-deploy-plugin options

AWS-SDK References


License

MIT

Package Sidebar

Install

npm i gulp-aws-stepfunctions-deploy

Weekly Downloads

1

Version

0.2.1

License

MIT

Unpacked Size

20.5 kB

Total Files

11

Last publish

Collaborators

  • yurgenua