Boto的get_all_images功能

时间:2013-08-20 11:34:17

标签: amazon-ec2 boto

我尝试使用Python boto库加载AWS图像列表。所以我的代码就像

con = boto.connect_ec2(user, pasw)
con.get_all_instances()
con.get_all_images()

问题是,get_all_instances()工作正常,但get_all_images()没有响应。当从kbd停止申请时,我看到了

  File "eagle/main.py", line 102, in <module>
    main(sys.argv[1:])
  File "eagle/main.py", line 97, in main
    return request, process_request(request)
  File "eagle/main.py", line 45, in process_request
    request = each().process_request(request)
  File "/home/rustem/projects/eagle.2.0/eagle/../eagle/middlewares/standard.py", line 64, in process_request
    request.images = con.get_all_images()
  File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/ec2/connection.py", line 171, in get_all_images
    [('item', Image)], verb='POST')
  File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/connection.py", line 1063, in get_list
    body = response.read()
  File "/home/rustem/envs/eagle.2.0/lib/python2.7/site-packages/boto/connection.py", line 411, in read
    self._cached_response = httplib.HTTPResponse.read(self)
  File "/usr/lib64/python2.7/httplib.py", line 541, in read
    return self._read_chunked(amt)
  File "/usr/lib64/python2.7/httplib.py", line 590, in _read_chunked
    value.append(self._safe_read(chunk_left))
  File "/usr/lib64/python2.7/httplib.py", line 647, in _safe_read
    chunk = self.fp.read(min(amt, MAXAMOUNT))
  File "/usr/lib64/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
  File "/usr/lib64/python2.7/ssl.py", line 241, in recv
    return self.read(buflen)
  File "/usr/lib64/python2.7/ssl.py", line 160, in read
    return self._sslobj.read(len)
KeyboardInterrupt

似乎Boto的功能不起作用,AWS API没有响应。有没有类似的问题?感谢。

1 个答案:

答案 0 :(得分:1)

原因是get_all_images函数返回来自AWS的所有图像,因此它可以工作几分钟。我开始使用过滤器,现在需要合理的时间。