Create AWS Step Functions state machine
✓Works with OpenClaudeYou 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 --versionand credentials configured viaaws 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 allowingstates.amazonaws.com
Steps
- Create an IAM execution role for the state machine with trust policy allowing
states.amazonaws.comand attach a policy granting permissions to invoke your target services (Lambda, SQS, DynamoDB, etc.) - Define your state machine logic in Amazon States Language (JSON) — specify states (Task, Choice, Parallel, Wait, Pass, Catch, Retry) and transitions
- Validate your state machine definition using
aws stepfunctions validate-state-machine-definition --definition file://definition.json --type STANDARD - Create the state machine using
aws stepfunctions create-state-machinewith the validated definition and execution role ARN - Start an execution with
aws stepfunctions start-execution --state-machine-arn <arn> --input '{"key":"value"}'to test the workflow - Monitor execution status with
aws stepfunctions describe-execution --execution-arn <arn>and view step-by-step history usingaws stepfunctions get-execution-history - Add error handling via Catch blocks for failed tasks and Retry policies with exponential backoff for transient failures
- Deploy using CloudFormation or Terraform by defining the state machine as an
AWS::StepFunctions::StateMachineresource
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
Related Cloud (AWS/GCP/Azure) Skills
Other Claude Code skills in the same category — free to download.
Lambda Function
Create AWS Lambda function with handler
S3 Operations
Set up S3 bucket operations (upload, download, presigned URLs)
DynamoDB CRUD
Create DynamoDB CRUD operations
SQS Setup
Set up SQS queue producer and consumer
SNS Notifications
Configure SNS for push notifications
CloudFront Setup
Set up CloudFront CDN distribution
Cognito Auth
Implement AWS Cognito authentication
RDS Setup
Configure RDS database connection
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.