With an existing Step Functions definition JSON file, how can I use it directly in CDK to create a Step Function?
Here is the code snippet if it is useful to anyone.
private createStepFunction(props: {
stepfunction_name: string;
stepfunctions_role_arn: string;
}): stepfunctions.CfnStateMachine {
const file = fs.readFileSync("../step_functions/definition.asl.json");
const stepFunction = new stepfunctions.CfnStateMachine(
this,
"cfnStepFunction",
{
roleArn: props.stepfunctions_role_arn,
definitionString: file.toString(),
stateMachineName: props.stepfunction_name,
}
);
return stepFunction;
}
Use the L1 CfnStateMachine
construct. It has a definitionString prop that accepts a stringified JSON definition.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.