[StarCluster] Acquire the private IP via Starcluster as API

Justin Riley jtriley at MIT.EDU
Wed Jun 6 11:31:10 EDT 2012


Hi Håvard,

My apologies for the lack of documentation for the API - it's a major
item on the todo list. For now here's a rough overview to print all of
the private ip addresses for all nodes in a cluster:

============================================================
from starcluster import config
from starcluster import cluster

# Load the config
cfg = config.StarClusterConfig().load()
# Create a cluster "manager" object
cm = cluster.ClusterManager(cfg)
# Fetch an active cluster
cl = cm.get_cluster('mycluster')
# Iterate through the nodes and print the private ip address
for node in cl.nodes:
    print "%s: %s" % (node.alias, node.private_ip_address)
============================================================

You can also fetch a specific node by name:

node = cl.get_node_by_alias('node003')

or by instance id:

node = cl.get_node_by_id('i-99999')

or by the instance's dns name:

node = cl.get_node_by_id('ec2-blahblah.amazonaws.com')

Hope that helps,

~Justin

On Mon, Jun 04, 2012 at 02:34:51PM +0200, Håvard Wahl Kongsgård wrote:
> Hi, I'am looking for a way to acquire the private IP's for current
> instances via the Starcluster API. There is not much documentation for
> how to use the Starcluster API, can anyone guide me in the right
> direction?
>
> --
> Håvard Wahl Kongsgård
> Faculty of Medicine &
> Department of Mathematical Sciences
> NTNU
>
> http://havard.security-review.net/
>
> _______________________________________________
> StarCluster mailing list
> StarCluster at mit.edu
> http://mailman.mit.edu/mailman/listinfo/starcluster
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://mailman.mit.edu/pipermail/starcluster/attachments/20120606/e0b0d9e6/attachment.bin


More information about the StarCluster mailing list