2009/11/27

Note to self: too many publicly facing websites.

So, from now on:
  • Delicious is for storing bookmarks.
  • Reader is for sharing articles.
  • Twitter is for linking to stuff. (i.e. sharing stuff that I didn't come across in Reader)
Right now there's stuff duped between all three. I expect this to continue. It's not inconveniencing anyone, but it offends my sense of order. Oh well.

2009/11/18

Rolling your own EC2 administration code: the basics

So, instead of using a PaaS or SaaS to manage the IaaS, I'm writing code myself to do exactly what I want, to be published shortly I hope. Basic ingredients:
  • A library to access EC2, like Typica.
  • An SSH library like JSch, to exec commands and transfer files.
  • A templating engine for wrangling config files, such as Velocity.
  • Working knowledge of the platform. I'm probably going to discover a few more subtleties such as this one before I'm finished.
Aside: Maven2 may be looked upon with scorn in certain circles, but it does make life much easier. If certain packages included javadoc & source packages, and refrained from (e.g.) including log4j config files in the library JAR files, it would be even easier! Wouldn't that be nice.

2009/11/14

Using the EC2 API: console output blank, connection refused, socket timeout, etc.

Hello there. As usual, there's a world of difference between the conceptual usage of an API and it's real-world, practical stuff. In my adventures I'm stubbornly, block-headedly not interested in using EC2 via anything except the API, i.e. no command-line tools or management console (except for debugging), and so, I intend to be able to create my images etc. in a test-harness. For reasons to be enumerated anon. Anyway, the following stuff may be useful to people writing code that uses the EC2 API for the first time:
When booting an instance, it is not assumed that once it is "running", that SSH will be serving on port 22, neither can it be assumed that the console output is there. So if you want to SSH into your instance, first poll the instance state, and once it's "running", then poll on console output. Once it's there, it's complete, so you can retrieve the fingerprints and go on from there.
This is good to know of course if one wants to sling instances around, but I find it slightly incongruous is that I'm being charged for about a minute of time on a machine I can't access yet. Of course, from Amazon's perspective the instant (har) I'm blocking a slot on a server, then it's chargeable, so it makes sense from their perspective I guess.