Saturday, May 23, 2009

Perplexing Amazon EC2 bug

Amazon EC2 is Amazon's thingy where you can rent computer time. This is rather like the 60s, but simultaneously very modern, and probably connected to a CLOUD in some way! Yay!

Anyway, one of the things that you can and should do is that when you have your virtual machine set up just as you like it, you should make an image of it, so that you can deploy multiple clones of it.

Here is the procedure.


  • Put your super-sekrit keys in the /mnt directory (where, breaking with convention, a filesystem is mounted directly).
  • Install ec2 tools.
  • Curse, and remember that you need Java for them.
  • Install Java, making sure to accept Sun's (or Oracle's!) huge license agreement indicating that you are not a nuclear power plant, which pops up unexpectedly when you run apt-get, making baby Stallman cry.
  • Type ec2-bundle-vol -d /mnt/img -k mysecretkey.pem --cert mycert.pem -u [long number] my-lovely-image --arch x86_64
  • Wait
  • Now, do ec2-upload-bundle -b mynicebucket -m my-lovely-image.manifest.xml
  • Wait
  • Notice that it has failed for no good reason, with no sensible error message. Recall that these things must be smaller than 10gb. Delete stuff until smaller than 10gb, bundle and upload again.
  • Yay! It worked!
  • Go to the browser admin interface.
  • No, not with Safari, with Firefox. Otherwise it won't work.
  • Go to the AMI section, click 'Register New'.
  • Paste in link given to you by the upload stage.
  • Note that it looks okay on a cursory branch.
  • Shut down VM, because you don't need it now that you have an image of it.
  • Days later, attempt to start a new one from the image.
  • Note that while the screen to start it up comes up, it doesn't give you the option to choose a VM type. Fill in other details and click start. Note that it complains that you haven't chosen a VM type, but that it also won't let you.
  • Note that in the image description, the 'architecture' bit says 'undefined'.
What has gone wrong? Any ideas?

Well, you put a dash in your image name. Which is FORBIDDEN. Obviously. Not that the bundling script warns you of this, or that it's documented anywhere, or anything. Start again, without dashes, and note that it works this time.

Fortunately, I did not shut down the VM until I had checked I could launch it. Because I am PARANOID. One does not get far doing this sort of sysadmin-y task unless one is paranoid.

You learn something new every day, eh?

Bonus EC2 annoyance. When starting an image, you are asked whether you would like it in US East, US West, Europe or somewhere else. Fine so far, right? Ah, but. Click the 'advanced' tab, and you will be given the option to choose from one of three zones (seemingly datacenters), 'a', 'b' and 'c'. If you are foolish enough to assume that you don't have to click the advanced tab when starting any old image, you will simply be assigned to one of these randomly. This almost never matters, except quite often; latency between zones is far higher than within zones.

Bah.

0 comments:

Post a Comment