-
-
Save flexjames/535ed74b7de6024f4a0f180e393fc6ea to your computer and use it in GitHub Desktop.
Example AWS Step Function Iterator Pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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