Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example AWS Step Function Iterator Pattern
CreateSnapshot:
Type: Task
Resource: ${self:custom.function-arn}-CreateSnapshot
Next: CreateSnapshotIterator
Retry: ${file(common.yml):reqLimitRetry}
CreateSnapshotIterator:
Type: Task
Resource: ${self:custom.function-arn}-Iterate
InputPath: '$.snapshotCreateIterator'
ResultPath: '$.snapshotCreateIterator'
Next: IsCreateSnapshotIterationComplete
Retry: ${file(common.yml):reqLimitRetry}
IsCreateSnapshotIterationComplete:
Type: Choice
Choices:
- Variable: '$.snapshotCreateIterator.continue'
BooleanEquals: true
Next: CreateSnapshot
Default: WaitForSnapshotsCreate
WaitForSnapshotsCreate:
Type: Wait
Seconds: 60
Next: CheckSnapshotsCreateStatus
CheckSnapshotsCreateStatus:
Type: Task
Resource: ${self:custom.function-arn}-CheckSnapshotsCreateStatus
Next: EvaluateSnapshotsCreateStatus
ResultPath: '$.snapshotStatus'
Retry: ${file(common.yml):reqLimitRetry}
EvaluateSnapshotsCreateStatus:
Type: Choice
Choices:
- Variable: '$.snapshotStatus'
StringEquals: ${self:custom.status.failed}
Next: StopInstancesFailure
- Variable: '$.snapshotStatus'
StringEquals: ${self:custom.status.success}
Next: DeleteVolume
Default: WaitForSnapshotsCreate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.