简体   繁体   English

AWS boto3 图像服务员工作不正常

[英]AWS boto3 image waiter is not working properly

I am trying to write a python script with boto3 to create an AMI of an instance and tag the AMI and snapshots.我正在尝试使用 boto3 编写 python 脚本来创建实例的 AMI 并标记 AMI 和快照。 Once the AMI creation function executes I want the script to wait/sleep until the resources are created. AMI 创建函数执行后,我希望脚本等待/休眠,直到创建资源。 To do that I tried the below function.为此,我尝试了以下功能。 But it doesn't work, Any help here?但它不起作用,这里有帮助吗?

  ec2res = boto3.resource('ec2')
  ec2res.Image('ami-XXXXXX').wait_until_exists()

The image exists.图像存在。 Otherwise you wouldn't have an image ID to plug into your code.否则,您将没有可插入代码的图像 ID。 That's why the waiter is returning immediately.这就是为什么服务员会立即回来。 What you likely want is Image Available您可能想要的是图像可用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM