I want to use the RunTask function from the ECS API with step functions to return a result from my ECS tasks.
In the code that calls RunTask will the code pause and wait until StepFunction gets a success or failure status and would I be able to read the response after the API RunTask call:
//code...
var = RunTask(with Task Token...)
//will the program pause until the Task Token gets a response? and
//would I be able to add code here to read the value from the TaskToken?
String = var.TaskToken
//code...
Edit: On AWS webpage(https://docs.aws.amazon.com/step-functions/latest/dg/connect-ecs.html) step function integration with ECS RunTask is shown as this:
{
"StartAt":"Manage ECS task",
"States":{
"Manage ECS task":{
"Type":"Task",
"Resource":"arn:aws:states:::ecs:runTask.waitForTaskToken",
"Parameters":{
"LaunchType":"FARGATE",
"Cluster":"cluster-arn",
"TaskDefinition":"job-id",
"Overrides":{
"ContainerOverrides":[
{
"Name":"container-name",
"Environment":[
{
"Name":"TASK_TOKEN_ENV_VARIABLE",
"Value.$":"$$.Task.Token"
}
]
}
]
}
},
"End":true
}
}
}
I am slightly confused as how I would use this in my golang code. Is there an API that I would pass this into to start the ECS task wioth the state - for example:
task = StartTask(THE ABOVE JSON)
And would this API allow me to get a response after it performs RunTask in the State:
MY_VALUE = task.task_token