如何在libcloud中列出ec2-west中的节点

2024-10-02 02:23:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用libcoud列出ec2区域中的节点。我该怎么做?下面只有东方。在

Driver = get_driver(Provider.EC2)
conn = Driver(key, secret)
conn.list_nodes()

Tags: key区域getsecret节点driverec2conn
2条回答

您可以通过驱动程序初始化来完成此操作。例如:

ec2_conn = get_driver(Provider.EC2)(aws_key, aws_secret, region='us-west-1')
instances = ec2_conn.list_nodes(ex_node_ids=[i-xxxxxx])
print instances

您可以获得该地区的相关驱动程序:

cls = get_driver(Provider.EC2_US_WEST)
driver = cls(ACCESS_ID, SECRET_KEY)

取自this documentation page中的底部示例。在

相关问题 更多 >

    热门问题