StepFunctions Execution Form

Step Functions
Step Functions

Create a simple user interface for your team to start new State Machine executions. No need anymore to build cumbersome frontends, auth and APIs just start State Machine executions.

StepFunctionsExecutionForm construct is a simple way how to enable anyone in the team to start new State Machine executions with pre-defined input message shape.

Features

  • Easily trigger new State Machine executions
  • Define arbitrary number of input fields
  • Restart the state machine with the same payload
  • Build a custom message shape
  • Display custom instructions to give a guidance to the users

Preview

StepFunctions Execution Form App preview

Usage

lib/example-stack.ts
import * as cdk from 'aws-cdk-lib'
import { Pass, StateMachine } from 'aws-cdk-lib/aws-stepfunctions'
import { Buttonize, Input } from 'buttonize/cdk'
import { StepFunctionsExecutionForm } from 'buttonize/library'
import { Construct } from 'constructs'
export class ExampleStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props)
Buttonize.init(this, { apiKey: 'YOUR_API_KEY' })
const stateMachine = new StateMachine(this, 'StateMachine', {
definition: new Pass(this, 'PassTest')
})
new StepFunctionsExecutionForm(this, 'ExecutionForm', {
name: 'Product cache invalidation panel',
description:
'Trigger invalidation of a product in all the caches in the in the company systems',
stateMachine,
submitButtonLabel: 'Invalidate',
fields: [
Input.text({
id: 'id',
label: 'Product ID'
}),
Input.select({
id: 'reason',
options: [
{ label: 'New manual update', value: 'manual_update' },
{ label: 'System bug', value: 'bug' }
]
})
],
executionInput: {
operation: 'invalidate',
product: {
pid: '{{id}}'
},
metadata: {
reasonStatement: '{{reason.value}}'
}
}
})
}
}

State Machine input payload sample.json
{
"operation": "invalidate",
"product": {
"pid": "p123456789"
},
"metadata": {
"reasonStatement": "manual_update"
}
}

Simplified key-value fields definition

Buttonize uses Input.text component for the input elements.

lib/example-stack.ts
new StepFunctionsExecutionForm(this, 'ExecutionForm', {
stateMachineArn: 'arn:aws:states:<region>:<account-number>:stateMachine:<state-machine-name>',
fields: {
name: 'What is your name?'
}
/*
Same like:
fields: [
Input.text({
id: 'name',
label: 'What is your name?'
})
]
*/
})

State Machine input payload sample.json
{
"name": "John Doe"
}
Setup
New repository
npx create-buttonize --template library/step-functions-execution-form --api-key=YOUR_API_KEY
Existing repository
import { Buttonize } from 'buttonize/cdk'
import { StepFunctionsExecutionForm } from 'buttonize/library'
Buttonize.init(this, { apiKey: 'YOUR_API_KEY' })
new StepFunctionsExecutionForm(this, 'MessageForm', {
stateMachine: yourStateMachine,
fields: {
name: 'What is your name?'
}
})
Deploy
npx cdk deploy
Delete
npx cdk destroy
Package
npm buttonize
Source
github StepFunctionsExecutionForm.ts
Additional resources

Buttonize X.com profile Buttonize GitHub profile

© 2024 Buttonize OÜ

With ❤️ made in 🇨🇿

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.