0

My end goal is to get the operating system of an Amazon image. When I do:

connection = Fog::Compute.new(provider: 'AWS',
                              aws_access_key_id: 'blah',
                              aws_secret_access_key: 'thing')
images = connection.describe_images('Owner' => 'self').body['imagesSet']

The data I get returned does not include platform, as this documentation suggests. However, I do get values like:

architecture: "x86_64",
imageType: "machine",
kernelId: "aki-825ea7eb",

And if I Google for that kernel ID I find this page saying it's Linux. Is there a way I can pass kernelId to Amazon via Fog and get back data about that kernelId, such as linux?

On a separate note, sometimes my images don't have kernelId, so are there any other fields in a <DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2012-12-01/"> that are definite indicators of operating system?

Sarah Vessels
  • 30,930
  • 33
  • 155
  • 222

1 Answers1

0

Here's a solution if you have the Kernel ID using http://thecloudmarket.com.

Pass the Kernel ID to a variable in ruby.

    ker_id = imagesSet

    url = []
    url_0 = "http://thecloudmarket.com/image/"
    url_1 = "ker_id"
    url_2 = "#/definition"

    new_url = url_0 + url_1 _ url_2

There are many ways to forge this url just made it easy to read.

Then use nokogiri to parse the webpage and put the image name back into your script. I didn't see another notifiers in the documentation.

Duck1337
  • 524
  • 4
  • 16
  • I was hoping there would be a cleaner way, preferably a service on Amazon itself or even an external API, like an API from thecloudmarket.com. – Sarah Vessels Aug 28 '13 at 13:18