step
with
UP
github.com/ljacobsson/sfn-workflow-studio-sync
functions:
one: ...
two: ...
resources:
Resources:
YourAwesomeStepFunction:
Type: AWS::StepFunctions::StateMachine
Properties:
Definition: ${file(./the-output-of-the-plugin.json)}
DefinitionSubstitutions:
One: !Ref OneLambdaFunction
Two: !Ref TwoLambdaFunction
RoleArn: !GetAtt SFNRole.Arn
SFNRole:
Type AWS::Iam::Role
Properties:
...YOU GOT THIS :D
Don't put all the code in one lambda
test("Does my step function even work?", async () => {
const command = new StartExecutionCommand({
input: JSON.stringify({ ... }),
name: `test-invocation-${uuid()}`,
stateMachineArn: arn
});
const result = await sfn.send(command);
const execution = resolveWhenStatusComplete(response.executionArn);
await expect(execution).toResolve()
})
From most common states
design your workflow so you can re-run it and get a good outcome
When using lambdas decompose your logic
Using nested step functions when it makes sense
Step function API makes it possible to integrate workflow into your product
How possible is this in practice?
const chain = Chain.start(openCase)
.next(assignCase)
.next(workOnCase)
.next(
isComplete
.when(Condition.numberEquals('$.Status', 1), closeCase)
.when(
Condition.numberEquals('$.Status', 0),
escalateCase.next(jobFailed)
),
);