0.1.0 • Published 1 year ago
plow-connector-library v0.1.0
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-iamUsage
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
- A Step Function with a single "Pass" state that appends arbitrary data to the input.
- 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:
- Create a new CDK app or use an existing one.
- Import and use the
ConnectorConstructas shown in the usage example. - Synthesize your CDK app:
cdk synth - Review the generated CloudFormation template to ensure the Step Function and IAM role are created correctly.
- Deploy the stack to your AWS account:
cdk deploy - 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 buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit tests
0.1.0
1 year ago