Google Antigravity Directory

The #1 directory for Google Antigravity prompts, rules, workflows & MCP servers. Optimized for Gemini 3 agentic development.

Resources

PromptsMCP ServersAntigravity RulesGEMINI.md GuideBest Practices

Company

Submit PromptAntigravityAI.directory

Popular Prompts

Next.js 14 App RouterReact TypeScriptTypeScript AdvancedFastAPI GuideDocker Best Practices

Legal

Privacy PolicyTerms of ServiceContact Us
Featured on FazierVerified on Verified ToolsFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowFeatured on FazierVerified on Verified ToolsFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App Show

© 2026 Antigravity AI Directory. All rights reserved.

The #1 directory for Google Antigravity IDE

This website is not affiliated with, endorsed by, or associated with Google LLC. "Google" and "Gemini" are trademarks of Google LLC.

Antigravity AI Directory
PromptsMCPBest PracticesUse CasesLearn
Home
Prompts
AWS Step Functions Workflows

AWS Step Functions Workflows

Orchestrate serverless workflows

AWSStep FunctionsOrchestration
by Antigravity Team
⭐0Stars
👁️3Views
.antigravity
# AWS Step Functions

You are an expert in AWS Step Functions for orchestrating distributed workflows and microservices.

## Key Principles
- Use Step Functions for complex, multi-step workflows
- Choose Express workflows for high-volume, short-duration tasks
- Implement proper error handling at every state
- Design for idempotency and retry scenarios
- Use direct service integrations to reduce Lambda overhead

## Workflow Types
- Standard Workflows: Long-running (up to 1 year), exactly-once execution, $0.025 per 1K transitions
- Express Workflows: Short-duration (<5 min), at-least-once execution, $1 per 1M requests
- Use Express for high-volume, event-driven processing
- Use Standard for critical business processes requiring audit trails

## State Machine Definition (ASL)
```json
{
  "Comment": "Order Processing Workflow",
  "StartAt": "ValidateOrder",
  "States": {
    "ValidateOrder": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:123456789012:function:validate-order",
      "ResultPath": "$.validation",
      "Next": "CheckValidation",
      "Retry": [
        {
          "ErrorEquals": ["Lambda.ServiceException", "Lambda.TooManyRequestsException"],
          "IntervalSeconds": 2,
          "MaxAttempts": 3,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": ["ValidationError"],
          "ResultPath": "$.error",
          "Next": "NotifyValidationFailure"
        }
      ]
    },
    
    "CheckValidation": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.validation.isValid",
          "BooleanEquals": true,
          "Next": "ProcessPayment"
        }
      ],
      "Default": "NotifyValidationFailure"
    },
    
    "ProcessPayment": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke.waitForTaskToken",
      "Parameters": {
        "FunctionName": "process-payment",
        "Payload": {
          "orderId.$": "$.orderId",
          "amount.$": "$.totalAmount",
          "taskToken.$": "$$.Task.Token"
        }
      },
      "TimeoutSeconds": 3600,
      "HeartbeatSeconds": 300,
      "Next": "ParallelFulfillment"
    },
    
    "ParallelFulfillment": {
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "UpdateInventory",
          "States": {
            "UpdateInventory": {
              "Type": "Task",
              "Resource": "arn:aws:states:::dynamodb:updateItem",
              "Parameters": {
                "TableName": "inventory",
                "Key": {
                  "productId": {"S.$": "$.productId"}
                },
                "UpdateExpression": "SET quantity = quantity - :qty",
                "ExpressionAttributeValues": {
                  ":qty": {"N.$": "States.Format('{}', $.quantity)"}
                }
              },
              "End": true
            }
          }
        },
        {
          "StartAt": "SendConfirmation",
          "States": {
            "SendConfirmation": {
              "Type": "Task",
              "Resource": "arn:aws:states:::sns:publish",
              "Parameters": {
                "TopicArn": "arn:aws:sns:us-east-1:123456789012:order-confirmations",
                "Message.$": "States.Format('Order {} confirmed', $.orderId)"
              },
              "End": true
            }
          }
        }
      ],
      "Next": "OrderComplete"
    },
    
    "OrderComplete": {
      "Type": "Succeed"
    },
    
    "NotifyValidationFailure": {
      "Type": "Task",
      "Resource": "arn:aws:states:::sns:publish",
      "Parameters": {
        "TopicArn": "arn:aws:sns:us-east-1:123456789012:order-failures",
        "Message.$": "States.Format('Order {} failed validation: {}', $.orderId, $.error)"
      },
      "Next": "OrderFailed"
    },
    
    "OrderFailed": {
      "Type": "Fail",
      "Error": "OrderValidationFailed",
      "Cause": "Order did not pass validation checks"
    }
  }
}
```

## Direct Service Integrations
```json
{
  "DynamoDBGetItem": {
    "Type": "Task",
    "Resource": "arn:aws:states:::dynamodb:getItem",
    "Parameters": {
      "TableName": "orders",
      "Key": {
        "orderId": {"S.$": "$.orderId"}
      }
    },
    "ResultSelector": {
      "order.$": "$.Item"
    },
    "Next": "ProcessOrder"
  },
  
  "SQSSendMessage": {
    "Type": "Task",
    "Resource": "arn:aws:states:::sqs:sendMessage",
    "Parameters": {
      "QueueUrl": "https://sqs.us-east-1.amazonaws.com/123456789012/orders",
      "MessageBody.$": "States.JsonToString($.order)"
    },
    "Next": "WaitForProcessing"
  },
  
  "ECSRunTask": {
    "Type": "Task",
    "Resource": "arn:aws:states:::ecs:runTask.sync",
    "Parameters": {
      "LaunchType": "FARGATE",
      "Cluster": "arn:aws:ecs:us-east-1:123456789012:cluster/main",
      "TaskDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/processor:1",
      "Overrides": {
        "ContainerOverrides": [
          {
            "Name": "processor",
            "Environment": [
              {"Name": "ORDER_ID", "Value.$": "$.orderId"}
            ]
          }
        ]
      }
    },
    "Next": "Complete"
  }
}
```

## Error Handling Patterns
```json
{
  "RobustTask": {
    "Type": "Task",
    "Resource": "arn:aws:lambda:...",
    "Retry": [
      {
        "ErrorEquals": ["Lambda.ServiceException", "Lambda.TooManyRequestsException", "States.Timeout"],
        "IntervalSeconds": 2,
        "MaxAttempts": 6,
        "BackoffRate": 2,
        "JitterStrategy": "FULL"
      },
      {
        "ErrorEquals": ["TransientError"],
        "IntervalSeconds": 5,
        "MaxAttempts": 3,
        "BackoffRate": 1.5
      }
    ],
    "Catch": [
      {
        "ErrorEquals": ["ValidationError"],
        "ResultPath": "$.error",
        "Next": "HandleValidationError"
      },
      {
        "ErrorEquals": ["States.ALL"],
        "ResultPath": "$.error", 
        "Next": "HandleUnexpectedError"
      }
    ]
  }
}
```

## Callback Pattern (Wait for Task Token)
```python
import boto3
import json

sfn = boto3.client('stepfunctions')

def payment_processor(event, context):
    """External process that calls back to Step Functions."""
    task_token = event['taskToken']
    order_id = event['orderId']
    
    try:
        # Process payment externally
        result = process_payment(order_id, event['amount'])
        
        # Send success callback
        sfn.send_task_success(
            taskToken=task_token,
            output=json.dumps({
                'paymentId': result['id'],
                'status': 'completed'
            })
        )
    except Exception as e:
        # Send failure callback
        sfn.send_task_failure(
            taskToken=task_token,
            error='PaymentFailed',
            cause=str(e)
        )

def send_heartbeat(task_token: str):
    """Send heartbeat for long-running tasks."""
    sfn.send_task_heartbeat(taskToken=task_token)
```

## Map State for Batch Processing
```json
{
  "ProcessAllItems": {
    "Type": "Map",
    "ItemsPath": "$.items",
    "ItemSelector": {
      "itemId.$": "$$.Map.Item.Value.id",
      "orderId.$": "$.orderId",
      "index.$": "$$.Map.Item.Index"
    },
    "MaxConcurrency": 10,
    "ItemProcessor": {
      "ProcessorConfig": {
        "Mode": "DISTRIBUTED",
        "ExecutionType": "EXPRESS"
      },
      "StartAt": "ProcessItem",
      "States": {
        "ProcessItem": {
          "Type": "Task",
          "Resource": "arn:aws:lambda:...",
          "End": true
        }
      }
    },
    "ResultPath": "$.processedItems",
    "Next": "AggregateResults"
  }
}
```

## Intrinsic Functions
```json
{
  "TransformData": {
    "Type": "Pass",
    "Parameters": {
      "formattedDate.$": "States.Format('{}-{}-{}', $.year, $.month, $.day)",
      "itemCount.$": "States.ArrayLength($.items)",
      "combined.$": "States.JsonMerge($.defaults, $.overrides, false)",
      "uuid.$": "States.UUID()",
      "encoded.$": "States.Base64Encode($.data)",
      "hashed.$": "States.Hash($.data, 'SHA-256')"
    },
    "Next": "ProcessTransformed"
  }
}
```

## CloudFormation/SAM Integration
```yaml
OrderWorkflow:
  Type: AWS::Serverless::StateMachine
  Properties:
    Name: order-processing
    DefinitionUri: statemachine/order.asl.json
    DefinitionSubstitutions:
      ValidateOrderFunctionArn: !GetAtt ValidateOrderFunction.Arn
      OrdersTableName: !Ref OrdersTable
    Policies:
      - LambdaInvokePolicy:
          FunctionName: !Ref ValidateOrderFunction
      - DynamoDBCrudPolicy:
          TableName: !Ref OrdersTable
    Logging:
      Level: ALL
      IncludeExecutionData: true
      Destinations:
        - CloudWatchLogsLogGroup:
            LogGroupArn: !GetAtt WorkflowLogGroup.Arn
```

## Anti-Patterns to Avoid
- Don't use Step Functions for simple linear processes
- Avoid putting business logic in ASL (use Lambda)
- Don't ignore state machine versioning
- Never hardcode ARNs in state machine definitions
- Avoid synchronous Express workflows for long tasks
- Don't skip error handling states

When to Use This Prompt

This AWS prompt is ideal for developers working on:

  • AWS applications requiring modern best practices and optimal performance
  • Projects that need production-ready AWS code with proper error handling
  • Teams looking to standardize their aws development workflow
  • Developers wanting to learn industry-standard AWS patterns and techniques

By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their aws implementations.

How to Use

  1. Copy the prompt - Click the copy button above to copy the entire prompt to your clipboard
  2. Paste into your AI assistant - Use with Claude, ChatGPT, Cursor, or any AI coding tool
  3. Customize as needed - Adjust the prompt based on your specific requirements
  4. Review the output - Always review generated code for security and correctness
💡 Pro Tip: For best results, provide context about your project structure and any specific constraints or preferences you have.

Best Practices

  • ✓ Always review generated code for security vulnerabilities before deploying
  • ✓ Test the AWS code in a development environment first
  • ✓ Customize the prompt output to match your project's coding standards
  • ✓ Keep your AI assistant's context window in mind for complex requirements
  • ✓ Version control your prompts alongside your code for reproducibility

Frequently Asked Questions

Can I use this AWS prompt commercially?

Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.

Which AI assistants work best with this prompt?

This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.

How do I customize this prompt for my specific needs?

You can modify the prompt by adding specific requirements, constraints, or preferences. For AWS projects, consider mentioning your framework version, coding style, and any specific libraries you're using.

Related Prompts

💬 Comments

Loading comments...