com.norbl.util.aws
Class EC2Utils

java.lang.Object
  extended by com.norbl.util.aws.EC2Utils

public class EC2Utils
extends java.lang.Object

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


Constructor Summary
EC2Utils()
           
 
Method Summary
static java.util.Map<java.lang.String,java.lang.String> decodeUserParams(java.lang.String params)
          This method decodes key/value pairs from a user-data string
static java.lang.String encodeUserParams(java.util.Map<java.lang.String,java.lang.String> params)
          This method encodes key/value pairs into a user-data string
static java.util.Map<java.lang.String,java.lang.String> getInstanceMetadata()
          This method makes a best effort to fetch all instance metadata.
static java.lang.String getInstanceMetadata(java.lang.String key)
          This method makes a best effort to fetch a piece of instance metadata.
static java.lang.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 java.util.Map<java.lang.String,java.lang.String> getInstanceMetadata()
This method makes a best effort to fetch all instance metadata.

Returns:
map of metadata

getInstanceMetadata

public static java.lang.String getInstanceMetadata(java.lang.String key)
                                            throws java.io.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:
java.io.IOException

getInstanceUserdata

public static java.lang.String getInstanceUserdata()
                                            throws java.io.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:
java.io.IOException

encodeUserParams

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


decodeUserParams

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