com.xerox.amazonws.ec2
Class EC2Utils

java.lang.Object
  extended by com.xerox.amazonws.ec2.EC2Utils

public class EC2Utils
extends Object

This class provides helper methods to interact with the Amazon EC2 service.

Author:
D. Kavanagh, developer@dotech.com

Constructor Summary
EC2Utils()
           
 
Method Summary
static Map<String,String> decodeUserParams(String params)
          This method decodes key/value pairs from a user-data string
static String encodeUserParams(Map<String,String> params)
          This method encodes key/value pairs into a user-data string
static Map<String,String> getInstanceMetadata()
          This method makes a best effort to fetch all instance metadata.
static String getInstanceMetadata(String key)
          This method makes a best effort to fetch a piece of instance metadata.
static String getInstanceUserdata()
          This method makes a best effort to fetch a piece of instance metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EC2Utils

public EC2Utils()
Method Detail

getInstanceMetadata

public static Map<String,String> getInstanceMetadata()
This method makes a best effort to fetch all instance metadata.

Returns:
map of metadata

getInstanceMetadata

public static String getInstanceMetadata(String key)
                                  throws IOException
This method makes a best effort to fetch a piece of instance metadata.

Parameters:
key - the name of the metadata to fetch
Returns:
value of the metadata item
Throws:
IOException

getInstanceUserdata

public static String getInstanceUserdata()
                                  throws IOException
This method makes a best effort to fetch a piece of instance metadata.

Parameters:
key - the name of the metadata to fetch
Returns:
value of the metadata item
Throws:
IOException

encodeUserParams

public static String encodeUserParams(Map<String,String> params)
This method encodes key/value pairs into a user-data string


decodeUserParams

public static Map<String,String> decodeUserParams(String params)
This method decodes key/value pairs from a user-data string