What happens when I stop an execution in AWS Step Functions?

I did the testing and it turns out that SFN does absolutely nothing to stop a running task. However, if you try to SendTaskHeartbeat on a stopped execution it will throw a TaskTimedOut error.

What I ended up doing was to verify the output of SendTaskHeartbeat, catch TaskTimedOut and proceed with the task cancellation on the worker side.

Note: The same TaskTimedOut error happens on SendTaskSuccess/SendTaskFailure.


In the case of Batch job, it does stop the step and the Job Terminate with exitCode 1 and the following reason: Status reason: The Task state in AWS Step Functions execution [arn:aws:states:us-west-2:12345678912:execution:JobStateMachine:00000-c583-2050-f8b1-9d36e05f4266] which was managing this resource was aborted