StarCluster - Mailing List Archive

Re: Acquire the private IP via Starcluster as API

From: Justin Riley <no email>
Date: Wed, 6 Jun 2012 11:31:10 -0400

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



  • application/pgp-signature attachment: stored
Received on Wed Jun 06 2012 - 11:31:13 EDT
This archive was generated by hypermail 2.3.0.

Search:

Sort all by:

Date

Month

Thread

Author

Subject