Skip to content

Instantly share code, notes, and snippets.

@caryp
Created July 21, 2009 02:30
Show Gist options
  • Save caryp/151064 to your computer and use it in GitHub Desktop.
Save caryp/151064 to your computer and use it in GitHub Desktop.
Cloud Agnostic Attributes ¶
To avoid coding cloud specific attributes (like EC2's "public_ipv4") into recipes it would be nice to make available "cloud agnostic" attributes in the chef node. These attributes would be a collection of instance information that is common across all clouds (such as instance identifiers and public/private ip addresses). By abstracting these platform specific values and placing them in the chef node it will provide a uniform way for recipes to access instance information without adding 'if' or 'case' statement within the recipes.
Not only will this avoid clutter in the recipes, but it will also avoid a maintenance burden by placing cloud specific code in one place.
Some attributes immediately apparent are:
instance_id : an instance identifier assigned by the cloud provider. public_ip : the public facing IP address for the instance. private_ip : the private IP address for the instance. others??
naming suggestions ¶
To group all attributes in a common namespace, we would probably follow the chef convention by adding keys to a 'mash' object named "cloud". The names for the attributes identified above would then be accessed by recipes in the following manor:
my_id = @node[:cloud][:instance_id]
public_ip = @node[:cloud][:public_ip]
private_ip = @node[:cloud][:private_ip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment