How to block until EC2 status check is passed usin

2019-08-16 16:56发布

I have the following python code to detect whether an EC2 is really started. But it completes when "instance state" shows running. which API function should I use to block until EC2 "status check" show "2/2 checks passed"

ec2 = boto3.resource('ec2')
instance = ec2.Instance(instanceid)
instance.wait_until_running()

1条回答
乱世女痞
2楼-- · 2019-08-16 17:06

It is rare that you would need to wait for the status check to pass.

When an instance enters the running state, the machine boots, loads the operating system and generally "runs".

The EC2 Status Checks are an independent process that check attributes of the virtual machine. However, your machine is normally running, and you can login to it, well before the status checks show a positive response.

If you do wish to wait for the Status Check, there are two waiters that might do this, but the documentation is unclear:

查看更多
登录 后发表回答