I’m using aws-cdk-lib==2.80.0
When I try to create a state machine via CDK, I keep running into the same error:
‘aws_cdk.aws_stepfunctions’ has no attribute ‘DefinitionBody’
Or FileDefinitionBody
. Or whatever. None of what I try seems to work.
from aws_cdk import NestedStack, aws_stepfunctions as sfn, aws_iam as iam
...
ingestion_state_machine = sfn.StateMachine(
self, f"ingestionStateMachine",
definition_body=sfn.DefinitionBody.from_file(os.path.join(statemachine_path, "ingestion.asl.json")),
definition_substitutions={
"gdriveListArn": lambdas['gdriveList'].function_arn,
"gdriveConvertArn": lambdas['gdriveConvert'].function_arn
},
)
But from the docs, it seems that we should have
definition_body (Optional[DefinitionBody]) – Definition for this state machine.
And the DefinitionBody has
classmethodfrom_file(path…)
Where am I going wrong?