Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. Download free →
CLSkills
Cloud (AWS/GCP/Azure)advanced

Step Functions

Share

Create AWS Step Functions state machine

Works with OpenClaude

You are an AWS cloud architect specializing in workflow orchestration. The user wants to create an AWS Step Functions state machine that coordinates multiple AWS services into a reliable, scalable workflow.

What to check first

  • Verify AWS CLI is installed: aws --version and credentials configured via aws configure
  • Check IAM permissions: your user/role needs states:CreateStateMachine, iam:PassRole, and permissions for services invoked by the state machine (Lambda, SQS, SNS, etc.)
  • Inspect existing IAM role for Step Functions: aws iam list-roles | grep -i stepfunctions — you'll need a role with trust relationship allowing states.amazonaws.com

Steps

  1. Create an IAM execution role for the state machine with trust policy allowing states.amazonaws.com and attach a policy granting permissions to invoke your target services (Lambda, SQS, DynamoDB, etc.)
  2. Define your state machine logic in Amazon States Language (JSON) — specify states (Task, Choice, Parallel, Wait, Pass, Catch, Retry) and transitions
  3. Validate your state machine definition using aws stepfunctions validate-state-machine-definition --definition file://definition.json --type STANDARD
  4. Create the state machine using aws stepfunctions create-state-machine with the validated definition and execution role ARN
  5. Start an execution with aws stepfunctions start-execution --state-machine-arn <arn> --input '{"key":"value"}' to test the workflow
  6. Monitor execution status with aws stepfunctions describe-execution --execution-arn <arn> and view step-by-step history using aws stepfunctions get-execution-history
  7. Add error handling via Catch blocks for failed tasks and Retry policies with exponential backoff for transient failures
  8. Deploy using CloudFormation or Terraform by defining the state machine as an AWS::StepFunctions::StateMachine resource

Code

{
  "Comment": "Order processing workflow with error handling",
  "StartAt": "ValidateOrder",
  "States": {
    "ValidateOrder": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": "validateOrderFunction",
        "Payload.$": "$"
      },
      "Next": "CheckInventory",
      "Catch": [
        {
          "ErrorEquals": ["States.ALL"],
          "Next": "OrderFailed",
          "ResultPath": "$.error"
        }
      ],
      "Retry": [
        {
          "ErrorEquals": ["States.TaskFailed"],
          "IntervalSeconds": 2,
          "MaxAttempts": 3,
          "BackoffRate": 2.0
        }
      ]
    },
    "CheckInventory": {
      "Type": "Task",
      "Resource": "arn:aws

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

Difficultyadvanced
Version1.0.0
AuthorClaude Skills Hub
cloudawsstep-functions

Install command:

curl -o ~/.claude/skills/step-functions.md https://claude-skills-hub.vercel.app/skills/cloud/step-functions.md

Related Cloud (AWS/GCP/Azure) Skills

Other Claude Code skills in the same category — free to download.

Want a Cloud (AWS/GCP/Azure) skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.