Ends in
00
days
00
hrs
00
mins
00
secs
ENROLL NOW

Get any AWS Specialty Mock Test for FREE when you Buy 2 AWS Pro-Level Practice Tests – as LOW as $10.49 USD each ONLY!

Amazon Simple WorkFlow (Amazon SWF)

Home » AWS Cheat Sheets » AWS Application Services » Amazon Simple WorkFlow (Amazon SWF)

Amazon Simple WorkFlow (Amazon SWF)

Last updated on June 23, 2023

Amazon Simple WorkFlow Cheat Sheet

  • A fully-managed state tracker and task coordinator in the Cloud. You create desired workflows with their associated tasks and any conditional logic you wish to apply and store them with SWF.

Features

  • SWF promotes a separation between the control flow of your background job’s stepwise logic and the actual units of work that contain your unique business logic.
  • SWF manages your workflow execution history and other details of your workflows across 3 availability zones.
  • SWF lets you write your application components and coordination logic in any programming language and run them in the cloud or on-premises.
  • SWF is highly scalable. It gives you full control over the number of workers you run for each activity type and the number of instances you run for a decider.
  • SWF also provides the AWS Flow Framework to help developers use asynchronous programming in the development of their applications.
  • Tutorials dojo strip

Concepts

  • Workflow
    • A set of activities that carry out some objective, together with logic that coordinates the activities.
    • Workflows coordinate and manage the execution of activities that can be run asynchronously across multiple computing devices and that can feature both sequential and parallel processing.
    • Each workflow runs in an AWS resource called a domain, which controls the workflow’s scope.
    • An AWS account can have multiple domains, each of which can contain multiple workflows, but workflows in different domains can’t interact.
    • When you register an activity to a workflow, you provide information such as a name and version, and some timeout values based on how long you expect the activity to take.
  • Activity Task
    • An activity task tells an activity worker to perform its function.
    • SWF stores tasks and assigns them to workers when they are ready, tracks their progress, and maintains their state, including details on their completion.
    • To coordinate tasks, you write a program that gets the latest state of each task from SWF and uses it to initiate subsequent tasks.
    • Activity tasks can run synchronously or asynchronously. They can be distributed across multiple computers, potentially in different geographic regions, or they can all run on the same computer.
    • Activity tasks for a running workflow execution appear on the activity task list, which is provided when you schedule an activity in the workflow.
    • If you don’t specify a task list when scheduling an activity task, the task is automatically placed on the default task list.
  • Lambda task
    • Executes a Lambda function instead of a traditional SWF activity.
  • Decision task
    • A Decision task tells a decider that the state of the workflow execution has changed so that the decider can determine the next activity that needs to be performed. The decision task contains the current workflow history.
    • SWF assigns each decision task to exactly one decider and allows only one decision task at a time to be active in a workflow execution.
  • Workflow Starter
    • Any application that can initiate workflow executions.
  • Activity Worker
    • An activity worker is a program that receives activity tasks, performs them, and provides results back.
    • Implement workers to perform tasks. These workers can run either on cloud infrastructure, or on your own premises.
    • Different activity workers can be written in different programming languages and run on different operating systems.
    • Assigning particular tasks to particular activity workers is called task routing. Task routing is optional.
  • Decider
    • A software program that contains the coordination logic in a workflow.
    • It schedules activity tasks, provides input data to the activity workers, processes events that arrive while the workflow is in progress, and ultimately ends the workflow when the objective has been completed.
    • Both activity workers and the decider receive their tasks by polling the SWF service.
  • Workflow Execution History
    • The workflow execution history is composed of events, where an event represents a significant change in the state of the workflow execution.
    • SWF informs the decider of the state of the workflow by including, with each decision task, a copy of the current workflow execution history.
  • Polling
    • Deciders and activity workers communicate with SWF using long polling.

Workflow Execution

  1. Write activity workers that implement the processing steps in your workflow.
  2. Write a decider to implement the coordination logic of your workflow.
  3. Register your activities and workflow with Amazon SWF.
  4. Start your activity workers and decider.
  5. Start one or more executions of your workflow. Each execution runs independently and you can provide each with its own set of input data. When an execution is started, Amazon SWF schedules the initial decision task. In response, your decider begins generating decisions which initiate activity tasks. Execution continues until your decider makes a decision to close the execution.
  6. Filter and view complete details of running as well as completed executions.

SWF provides service operations that are accessible through HTTP requests.

Endpoints

  • To reduce latency and to store data in a location that meets your requirements, SWF provides endpoints in different regions.
  • Each endpoint is completely independent. When you register an SWF domain, workflow or activity, it exists only within the region you registered it in.

AWS Flow Framework

  • An enhanced SDK for writing distributed, asynchronous programs that can run as workflows on SWF.
  • It is available for the Java and Ruby programming languages, and it provides classes that simplify writing complex distributed programs.

Amazon SWF Pricing

  • You pay for workflow executions when you start them and for each 24-hour period until they are completed. The first 24 hours of workflow execution are free.
  • You pay for “markers” (custom workflow execution log entries), start timers, or receive signals of additional tasks generated from a workflow.
  • AWS Exam Readiness Courses
  • Data transferred between SWF and other AWS services within a single region is free of charge. Data transferred between SWF and other AWS services in different regions will be charged at Internet Data Transfer rates on both sides of the transfer. First 1 GB of transferred data is free.

SQS vs SWF

  • SQS offers reliable, highly-scalable hosted queues for storing messages while they travel between applications or microservices.
  • SWF is a web service that makes it easy to coordinate work across distributed application components.
  • SWF API actions are task-oriented. SQS API actions are message-oriented.
  • SWF keeps track of all tasks and events in an application. SQS requires you to implement your own application-level tracking.
  • SWF offers several features that facilitate application development, such as passing data between tasks, signaling, and flexibility in distributing tasks.

Amazon SWF Limits

  • Maximum registered domains – 100
  • Maximum workflow and activity types – 10,000 each per domain
  • Maximum open workflow executions – 100,000 per domain
  • Maximum open activity tasks – 1,000 per workflow execution
  • Maximum workflow execution time – 1 year
  • Each workflow execution history can grow up to 25,000 events
  • Maximum task execution time – 1 year
  • Schedule up to 100 activity tasks in one decision
  • Maximum execution history retention is 90 days.

Amazon SWF Cheat Sheet Sources:

https://docs.aws.amazon.com/amazonswf/latest/developerguide/
https://aws.amazon.com/swf/faqs/
https://aws.amazon.com/swf/pricing/

Get any AWS Specialty Mock Test for FREE when you Buy 2 AWS Pro-Level Practice Tests – as LOW as $10.49 USD each ONLY!

Tutorials Dojo portal

Learn AWS with our PlayCloud Hands-On Labs

Tutorials Dojo Exam Study Guide eBooks

tutorials dojo study guide eBook

FREE AWS Exam Readiness Digital Courses

Subscribe to our YouTube Channel

Tutorials Dojo YouTube Channel

FREE AWS, Azure, GCP Practice Test Samplers

Follow Us On Linkedin

Recent Posts

Written by: Jon Bonso

Jon Bonso is the co-founder of Tutorials Dojo, an EdTech startup and an AWS Digital Training Partner that provides high-quality educational materials in the cloud computing space. He graduated from Mapúa Institute of Technology in 2007 with a bachelor's degree in Information Technology. Jon holds 10 AWS Certifications and is also an active AWS Community Builder since 2020.

AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!

Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!

View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE courses

Our Community

~98%
passing rate
Around 95-98% of our students pass the AWS Certification exams after training with our courses.
200k+
students
Over 200k enrollees choose Tutorials Dojo in preparing for their AWS Certification exams.
~4.8
ratings
Our courses are highly rated by our enrollees from all over the world.

What our students say about us?