Introducing virtuerl
Posted: January 17th, 2008 | Author: kevin | Filed under: Erlang | View CommentsI’ve been putting in some long hours in the evenings working on my next project, virtuerl. virtuerl is a Erlang library which eases working with grid computing resources like Amazon’s EC2. Right now is just a nice wrapper around EC2’s query API but I have bigger plans for it.
A lot of the API is already in place which is a testament to how productive Erlang makes me. I’ve been working on this 2-3 hours a night, 2-3 nights a week for two weeks and its already pretty usable. The current API has calls for EC2 image description, keypair management, and instance management. What this means is that you can call most of the useful APIs right now in just a few lines of Erlang code.
Here’s an example of starting and stopping an instance:
Keys = aws_keys:new("YourIdentifier", "YourSecretKey"),
case aws_instance:run(Keys, "gsg-keypair", "ami-0022c769") of
{ok, [H|_T]} ->
case aws_instance:terminate(Keys, proplists:get_value(instanceId, H)) of
{ok, _Result} ->
io:format("Instance terminated~n");
{error, Error} ->
io:format("Oops! Instance still running: ~p~n", [Error])
end;
{error, Error} ->
io:format("Error: ~p~n", [Error]),
io:format("Oops! Running instance failed!~n")
end.
Next steps are to add edoc, license boilerplate (Apache 2.0 license, for those who care about such things) and package virtuerl as an OTP application. If you’d like to check out the code, downloads are here and the Google Code project page is here.