AWSTemplateFormatVersion: '2010-09-09' Description: AWS Step Functions sample project for mapping over an array of elements Resources: MapStateStateMachine: Type: 'AWS::StepFunctions::StateMachine' Properties: DefinitionString: |- { "Comment": "A description of my state machine", "StartAt": "Iterate Over Input Array", "States": { "Iterate Over Input Array": { "Type": "Map", "ItemProcessor": { "ProcessorConfig": { "Mode": "INLINE" }, "StartAt": "Priority Filter", "States": { "Priority Filter": { "Type": "Choice", "Choices": [ { "Variable": "$.priority", "StringEquals": "LOW", "Next": "Low Priority Order Detected" }, { "Variable": "$.priority", "StringEquals": "HIGH", "Next": "Insert High Priority Order" } ] }, "Low Priority Order Detected": { "Type": "Succeed" }, "Insert High Priority Order": { "Type": "Task", "Resource": "arn:aws:states:::dynamodb:putItem", "Parameters": { "TableName": "MapStateTable", "Item": { "id": { "S.$": "$.orderId" }, "customerId": { "S.$": "$.customerId" }, "priority": { "S.$": "$.priority" } } }, "End": true } } }, "End": true, "ItemsPath": "$.Data", "MaxConcurrency": 1 } } } RoleArn: !GetAtt [StatesExecutionRole, Arn] StatesExecutionRole: Type: 'AWS::IAM::Role' Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: 'Allow' Principal: Service: states.amazonaws.com Action: 'sts:AssumeRole' Path: '/' Policies: - PolicyName: StatesExecutionPolicy PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: - 'dynamodb:PutItem' Resource: - !GetAtt DDBTable.Arn DDBTable: Type: AWS::DynamoDB::Table Properties: ProvisionedThroughput: ReadCapacityUnits: '1' WriteCapacityUnits: '1' AttributeDefinitions: - AttributeName: 'id' AttributeType: 'S' KeySchema: - AttributeName: 'id' KeyType: 'HASH' TableName: 'MapStateTable' Outputs: StateMachineArn: Value: Ref: MapStateStateMachine ExecutionInput: Description: Sample input to StartExecution. Value: '{}'