📋

Amazon SWF in AWS

Jul 17, 2024

Amazon SWF in AWS

Introduction

  • Amazon SWF: Simple Workflow Service
  • Provides programming model and infrastructure for coordinating distributed components and maintaining their execution state
  • Offers task-based API for easy coordination of work across distributed application components
  • Accessible via simple API calls from any language
  • Can be run on EC2 instances or any internet-connected machine
  • Focuses on the application aspects that differentiate it

Key Concepts

Workflow

  • Definition: A set of activities to achieve an objective
  • Workflow History: Complete and consistent record of each event since the workflow execution started, maintained by SWF

Application Workflow

  • Requires several processing steps via executable code, API calls, scripts, or human action
  • SWF manages dependencies, scheduling, load distribution, and other task associations

Example: E-commerce Order Process

  1. Customer places an order
  2. Order verified by team (e.g., Flipkart, Amazon)
  3. Approval triggers payment options (net banking, credit card, etc.)
  4. User inputs payment details, order placed
  5. Warehouse notified to ship the product
  6. Delivery notification sent to customer
  7. Order completion recorded in database

Creating SWF in AWS

Steps

  1. Log in to AWS account
  2. Go to Services -> SWF or search for Simple Workflow Service
  3. Choose to create a domain or launch a sample workflow
  4. Sample Workflow Creation:
    • Domain registration
    • Activity steps deployment
    • Run an execution
    • Publish
  5. Detailed Process:
    • Enter domain name and register
    • Activities registered (CPR transfer, grayscale upload, S3 upload)
    • Deploy product on EC2 if required
    • Acknowledge and continue through steps
    • Finalize instance creation

Benefits and Features of SWF

  1. Scalability
    • Auto-scales resources with application usage
    • No manual administration required
  2. Reliability
    • Runs in Amazon's highly available data centers
    • Tracks tasks and sends them to application components
  3. Logical Separation
    • Separates control flow and business logic
    • Easy to manage and scale according to business changes
  4. Simplicity
    • Replaces old workflow automation complexities
    • Developers focus on unique application functionality
  5. Flexibility
    • Modify application components and logic in any programming language
    • Run within the cloud or on-premises

Recap

  • Definition and components of SWF
  • Example of SWF in e-commerce order process
  • Steps to create SWF in AWS
  • Benefits and features of SWF