Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to AWS Step Functions

Koya Takei
August 26, 2024
13

Introduction to AWS Step Functions

Koya Takei

August 26, 2024
Tweet

Transcript

  1. About Me Name: Koya Takei Role: Software Engineer (3+ years)

    Experience: LIFULL Co., Ltd. (Proptech) -> M3, inc. (medical tech) Keywords: Operation improvement, Cost reduction
  2. What is Step Functions? - Visual workflow configuration service -

    Integrate and orchestrate different AWS services - AWS Lambda - ECS - SNS - Built-in functions - iteration - parallel execution - error handling
  3. Building workflow rapidly Defined by Amazon States Language (JSON) {

    "Function1": { "FunctionName": "arn:aws:lambda:...:function1", "Next": "Function2" }, "Function2": { "FunctionName": "arn:aws:lambda:...:function2", "Next": "Function3" }, "Function3": { "FunctionName": "arn:aws:lambda:...:function3", "End": true } }
  4. Dashboard Workflow dashboard will be created automatically Perform operations -

    Monitor progress - Jump to logs - Interrupt - Redrive
  5. Core Concepts - state machine - state entire workflow, which

    is a series of event-driven steps each step in a workflow combine states to build a state machine - state machine state machine state
  6. State Types Executes a specific task by calling an AWS

    service - Task State - Parallel State - Choice State Runs multiple branches of states simultaneously Branches workflow based on conditions
  7. Task State { "ECS Execution": { "Type": "Task", "Resource": "arn:aws:states:::ecs:runTask",

    "Parameters": { "TaskDefinition": "TaskDefinitionArn", "Overrides": { "Command": ["node", "index.js"] } } } } Running ECS task { "Publish to SNS": { "Type": "Task", "Resource": "arn:aws:states:::sns:publish", "Parameters": { "TopicArn": "TopicArn", "Message": "my message", } } } Sending message by SNS
  8. Parallel State Running multiple states in parallel { "Type": "Parallel",

    "Branches": [ { "LookUpAddress": { "Type": "Task", "FunctionName": "LambdaArn" } }, { "LookUpName": { "Type": "Task", "FunctionName": "LambdaArn" } } ], }
  9. Choice State { "Choice": { "Type": "Choice", "Choices": [{ "Variable":

    "$.price", "NumericGreaterThan": 10000, "Next": "SendMail" }], "Default": "SendItem" }, ... } Branching processes according to the input
  10. Other State Types - Map State - Pass State -

    Wait State - Success State - Fail State These can be combined to create complex workflows
  11. Thank you very much! Let's use Step Functions! Check out

    my blog post (Japanese) link https://www.m3tech.blog/entry/2024/03/26/140000 or searching “エムスリー バッチ改善”
  12. Wait State Pause and resume execution { "WaitAnHour": { "Type":

    "Wait", "Seconds": 3600, "Next": "Function" }, "Function": { "Type": "Task", "FunctionName": "LambdaArn" } }
  13. State Types Executes a specific task by calling an AWS

    service Task State Parallel State Choice State Wait State Runs multiple branches of states simultaneously Branches workflow based on conditions Pauses the workflow temporarily