Tampa
Tampa

Reputation: 78342

How to list nodes in ec2 west in libcloud

I want to list nodes in ec2 region using libcoud. How do I do that? Below gives east only.

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

Upvotes: 1

Views: 466

Answers (2)

cgseller
cgseller

Reputation: 4043

You can do this via the driver initialization. For example:

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

Upvotes: 1

Assaf Lavie
Assaf Lavie

Reputation: 76093

You can get the relevant driver for that region:

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

Taken from the bottom example in this documentation page.

Upvotes: 1

Related Questions