所以我试图让所有实例通过 python 检查它们的状态。
我在这里找到了一个有人建议的脚本,看起来像这样:
from boto.ec2.connection import EC2Connection
conn = EC2Connection('MY Key ID', 'Secret Access Key')
reservations = conn.get_all_instances()
instance = reservations.instances[0]
print instance.status
但是,每次我运行它时,我都会收到如下错误:
File "/usr/lib/python2.7/dist-packages/boto/ec2/connection.py", line 466, in get_all_instances
, verb='POST')
File "/usr/lib/python2.7/dist-packages/boto/connection.py", line 882, in get_list
response = self.make_request(action, params, path, verb)
File "/usr/lib/python2.7/dist-packages/boto/connection.py", line 868, in make_request
return self._mexe(http_request)
File "/usr/lib/python2.7/dist-packages/boto/connection.py", line 794, in _mexe
raise e
socket.gaierror: Errno -2 Name or service not known