Configure aws ec2 wait timeout

Is there an option or setting somewhere to control the timeout for a command aws ec2 wait

? Or the number of attempts or the waiting period between attempts?

I want to be able aws ec2 wait instance-terminated

to do some instances, I spin quickly to do multiple tasks and then complete. Occasionally ends up on some longer tasks with "Invalid Waiter Instance: Maximum Attempts Not Completed".

I can't seem to find anything. I copied the cli source code, but my Python knowledge is too limited for me to understand what's going on. I see there might be something in this test using maxAttempts and delay, but cannot figure out how to use that from the cli.

So far, my suboptimal solution is to sleep first and then start waiting.

+3


source to share


1 answer


The AWS CLI lacks a timeout option, but you can simply use the built-in command timeout

from coreutils to do what you want.

timeout 10 aws ec2 wait instance-terminated

      



will be canceled if the command does not return within 10 seconds. Timeout automatically returns error code 124, otherwise it returns command error code.

+2


source







All Articles