Thursday, August 1, 2013

Hacking weeds with Fog


If you're working on HPCloud you may want to monitor your assets, and know where your instances are running, and what state there in.  Additionally, you might be concerned with cost, which like many cloud providers, is determined by the size of the instance [read amount of allocated resources] and instance up time.  HPCloud provides you with 3 different ways of working with their OpenStack API.

Python Nova Client
Windows Shell
Ruby Fog - yes please!

If your reading this post you are likely already familiar with the awesomeness of Fog, if not you'll definitely want to take a gander at Fog.io

Fog works with different cloud providers and receives contributions of code changes which they push into their fog gem.  If your working with HPCloud its worth it to work to go ahead and grab HPCloud's HP Fog gem.  For more information check out: https://docs.hpcloud.com/bindings/fog

Assuming you are working with HP Fog version 20, you can connect like so:




Ok - thtats cool so we get a connection back that will allow us to work with the compute service...yawn.

So now lets do something a little more useful.  Lets imagine that every team member has a ppk or security key which is labeled by either the team or instance owners name.  We can group the number of instances using this ppk type for identifying assets or even use it to execute specific tasks on those labeled instances, maybe even throw in some Chef'ness to map specific roles.


Lastly I did mention earlier that I wanted to understand cost.  Well if you have multiple instances of different sizes, on different avalibilty zones your not going to want to do this by hand.


Even if working with Ruby isn't your thing, anyone can easily see the value that Fog is giving you.  Script-able infrastructure changes, and asset querying that spans the Compute, Storage, DNS, and CDN services is some crazy useful stuff.


Happy Bootstrapping!

No comments:

Post a Comment