I have the following definition. I want to be able to pass the current iteration number of the map to my ecs task like this python src.py --my_argument <index>. I used "$$.Map.Item.Index" but it doesn't work. I just runs it literally like this:
python src.py --my_argument $$.Map.Item.Index
{
"Comment": "A state machine that iterates over an array and creates an ECS task for each item.",
"StartAt": "IterateArray",
"States": {
"IterateArray": {
"Type": "Map",
"InputPath": "$.arrayField",
"ItemsPath": "$",
"MaxConcurrency": 0,
"Iterator": {
"StartAt": "RunECSTask",
"States": {
"RunECSTask": {
"Type": "Task",
"Resource": "arn:aws:states:::ecs:runTask.sync",
"Parameters": {
"LaunchType": "FARGATE",
"Cluster": "ClusterName",
"TaskDefinition": "TaskDefinitionName",
"Overrides": {
"ContainerOverrides": [
{
"Name": "yourContainerName",
"Command": [
"python",
"src.py",
"--my_argument",
"$$.Map.Item.Index"
]
}
]
}
},
"End": true
}
}
},
"End": true
}
}
}