Friday, July 29, 2011

How to find the right Ubuntu AMI with tools

A while ago, I gave instructions on how you could find the right Ubuntu AMI. I promised to write about how you could accomplished programmaticly.

When we publish Ubuntu AMIs, we simultaneously publish machine consumable data to https://cloud-images.ubuntu.com/query/. The data there contains information so that you can:
  • Find the latest ami of a given type (hvm/ebs/instance-store), arch, and region.
  • Download the pristine image files

I think the format of the data is generally discernible, but there is some more information on the Ubuntu Wiki.

I've put an example client together. Here is some example usage:
  • Launch the latest released image in us-east-1

  • $ euca-run-instances --instance-type t1.micro --key mykey $(ubuntu-ami)
  • Open the Amazon EC2 console to launch the latest Oneiric daily build

  • You can now directly link to launching an image in Amazon EC2 console, combine that with this tool to open your browser to the right page.
    $ ami=$(ubuntu-ami us-west-1 oneiric daily i386)
    $ gnome-open https://console.aws.amazon.com/ec2/home?region=us-west-1#launchAmi=${ami}

  • Download and extract the latest tarball for lucid
  • Here, 'pubname' is the recommended "publish name" of this AMI, which happens to correspond to the basename of the name on EC2, and "url" is a fully qualified url to http://cloud-images.ubuntu.com .
    $ wget $(ubuntu-ami -f "%{url} -O %{pubname}.tar.gz")
    $ uec-publish-tarball *.tar.gz my-ubuntu-images

I don't think I'll get this into 11.10, but I'd like to have something with this function into 12.04, and support launching AMIs directly through it for ease of use. I'd love to hear input on what you'd like a "ubuntu-run-instance" command to look like and do.

4 comments:

  1. Just a follow up, we've added 'ubuntu-cloudimg-query' to oneiric's cloud-utils package. It does what 'ubuntu-ami' did and more.

    ReplyDelete
  2. I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read !! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site. Chainsaw Parts

    ReplyDelete
  3. Thanks in favor of sharing such a nice idea, paragraph is good, thats why i have read it fully 일본야동

    Click this link
    한국야동

    ReplyDelete
  4. I need to to thank you for this excellent read!! I definitely loved every bit of it. I have got you bookmarked to check out new things you post. 국산야동

    Click this link
    야설

    ReplyDelete