Using AWS ECS with Boto3
Question: I would like to lunch a Task on ECS cluster and wait for the task termination.

    
    
    import boto3
    
    client = boto3.client('ecs')
    response = client.run_task(
        cluster='default',
        taskDefinition='RGB',
        overrides={
             'containerOverrides': [
                 {
                     'name': 'RGB',
                     'command': [
                         'python', 
                         '-u', 
                         'rgb.py'
                     ]
                 }
             ]
         }                   
        )
    
    arn = response["tasks"][0]['taskArn']
    waiter = client.get_waiter('tasks_running')
    waiter.wait(cluster='default', tasks=[arn])
    

Is it the correct way?

> I am getting: botocore.exceptions.WaiterError: Waiter TasksRunning failed:
> Waiter encountered a terminal failure state


Answer: Just change:

    
    
    waiter = client.get_waiter('tasks_running')
    

for

    
    
    waiter = client.get_waiter('tasks_stopped')
    

