aws-fargatespot-instances

In what task state can AWS Fargate spot interruption happen?


I couldn't find a documentation on, in which task state does AWS interrupt a Fargate spot task ?

  1. Can interruption happen during "provisioning", "pending" and "deprovisioning" states as well ?
  2. Do interruptions only happen during "running" state ?

I ask this because I have a code running on Fargate spot but runtime is less than 1 minute (way below termination duration - from warning to task being stopped). So in my case if interruption happens during "running" state only, I wouldn't bother about handling interruption.


Solution

  • Although I haven't found any documentation on this, I have solved this like following:

    # If task is in running/deprovisioning state when it was interrupted, no need to resubmit as our task takes less than 2 minutes to finish. AWS gives a 2 minutes warning and our task will finish before task is actually stopped
    if task_state.lower() == "running" or task_state.lower == "deprovisioning":
        run_task = False
    

    An answer to this question will add to knowledge of general audience is why I will leave the question here.