I met a hacker from an antique land
Who said: Two tall and heavy mounts of steel
Lie in a basement. Near them on a stand,
Recessed, a dark CRT lies, whose peel’d
Cracked shell of dullest beige, and blinkenlights,
Tell that its fact’ry well those old specs read
Which yet survive, inked on the lifeless thing,
The die that stamp’d them and the power that fed.
And on the burned-in screen these words appear:
“My name is Awsymandias, king of kings:
Look on my racks, ye Mighty, and despair!”
No bits at all remain. Not far away
A data center waits, its humming air
Host to a boundless cloud by th’hour to pay.
Awsymandias is a Ruby library designed to help you set up and tear down complicated (mighty!) AWS EC2 environments and to track running costs over time. It does this by persisting instance-specific metadata, such as (for example) its role within your stack, to SimpleDB, allowing you to deploy your Rails app to the same place from multiple different machines. This is helpful if you want to maintain several different deployment environments, such as testing, UAT, and preview, to be able to deploy to them from any machine with Capistrano and your deploy script available, and to be able to raise them up and tear them down at will.
Wherever possible, it also attempts to extend and improve upon the existing Ruby EC2 gem by bootstrapping a real domain model on top of the hash-like XML returned by EC2’s REST API. Currently this is being done with some funky ActiveResource sorcery which I hope to improve upon in the future.
# Give the stack a name, and describe its members. stack = Awsymandias::EC2::ApplicationStack.new("test") do |s| s.role "db", :instance_type => "m1.large", ... s.role "app", :instance_type => "c1.xlarge", ... end # Check if we're running by pulling stack description from SDB; if not, launch asynchronously. stack.launch unless stack.running? until stack.running? sleep(5) end # Capistrano task :test do set :db, stack.db.public_dns set :app, stack.app.public_dns end
The gem is available now from Github.