0.1.0 • Published 9 months ago

plow-connector-library v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

PLOW Connector Step Function Construct Library

This library provides a CDK construct that creates an AWS Step Function and connective IAM role for the use of integration with the PLOW Orchestrator. The Step Function includes a state that appends arbitrary data to the input structure and returns it as output.

Installation

To use this library in your CDK project, install it along with its dependencies:

npm install @aws-cdk/core @aws-cdk/aws-stepfunctions @aws-cdk/aws-iam

Usage

Import the ConnectorConstruct in your CDK stack and instantiate it:

import * as cdk from '@aws-cdk/core';
import { ConnectorConstruct } from './connector-construct';

class MyStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const myConstruct = new ConnectorConstruct(this, 'ConnectorConstruct');
    
    // Access the Step Function or IAM role if needed
    const stateMachine = myConstruct.stateMachine;
    const role = myConstruct.role;
  }
}

What's Included

  1. A Step Function with a single "Pass" state that appends arbitrary data to the input.
  2. An IAM role named "ConnectorAssumeRole" with the following specifications:
    • AWSStepFunctionsFullAccess managed policy
    • Custom policy allowing all EventBridge actions
    • Trust policy allowing assumption by AWS account 293332171327

Testing

To test this construct:

  1. Create a new CDK app or use an existing one.
  2. Import and use the ConnectorConstruct as shown in the usage example.
  3. Synthesize your CDK app:
    cdk synth
  4. Review the generated CloudFormation template to ensure the Step Function and IAM role are created correctly.
  5. Deploy the stack to your AWS account:
    cdk deploy
  6. Use the AWS Management Console or AWS CLI to trigger the Step Function and verify its behavior.

Customization

You can extend the ConnectorConstruct to add more states to the Step Function.

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests