<< ---------------------------------------------------------------- >>
--- Last Modified: $= dv.current().file.mtime
Step Functions
<< ---------------------------------------------------------------- >>
Coordinate multiple AWS services into serverless workflows.
2 Types of State Machines:
- Standrad:
- For durable checkpointed workflows, for machine learning, order fulfillment, it/devops automation, ETL, jobs and other long-distance workloads
- Express:
- Event-driven workflows for streaming data processing, microservices orchestration, IoT data ingestion, mobile backends, and other short duration, high-event-rate workloads.
Use Cases:
- Manage a Batch Job or Fargate Container
- if the job fails or succeeds, notifies via sns
- Run a fargate task, if it failes or succeeds notify via sns
- Transfer Data Records:
- Load up a DynamoDB table.
- add each item to the sqs queue
- as each item is processed remove the item from the table
- where thre are no more records report successfully complete
- transcoding media files:
- s3 → eventbridge event → trigger lambda to thumbnail, gather metadata etc…
- send messages/approval requests from automated workflows
- sequence steps of machine learning workflows
States
Parameters: key-value pairs that will be passed as input
Result: a virtual task to be passed to the next stage
ResultPath: where to place the “output” of the virtual task
Task States: respresents a single unit of work performed by a state machine
- AWS Labmda
- passing parameters to the API actions of other services - SNS, SQS, Fargate, Batch, ECS
- or using an activity
- enables you to have a task in your state machine wehre the work is performed by a worker that can be hosted on anywehre(EC2, ECS, phones)
- Activity task state are polled by the workers(its not pushed like the lambda or the other APIs)
- enables you to have a task in your state machine wehre the work is performed by a worker that can be hosted on anywehre(EC2, ECS, phones)
- Choice State
- adds branching logic to a state machine
- Wait State:
- delay by a period of time
- Success State
- stops an execution successfully
- a useful target for choice state branches that dont do anything but stop the execution
- Fail
- stops the execution of the state machine and its failurue and error
- Parallel States:
- expect two states to be performed. The state machine does not move forward until both states complete
- Map
- you can have an array and it will iterate through it and perforom an action
- pass:
- passes its input to its output, wihtout performing work (useful for constructing and debugging state machines.)