3

The AWS documentation says that one can see details of AMIs by running the following: aws ec2 describe-images

However, the returned description does not seem to include the kernel version (for Linux images).

Is there a way to find out the kernel of an AMI, other than starting and instance with it and looking inside?

(The reason I am asking is that I am currently trying to import an Ubuntu 18.04 image with aws ec2 import-image, but getting a ClientError: Unsupported kernel version 5.3.0-61-generic, so I would like to find out which kernels are supported, and I am not satisfied with the answers to the question What Linux Kernel Versions are Acceptable for AMI Import to Amazon Web Services?).

EDIT:

As it turns out, the kernels in existing AMIs are not necessarily supported for import. I created an Ubuntu 18.04 instance from an existing AMI, and determined its kernel to be 5.3.0-1023-aws.

This kernel is available as an Ubuntu package, so I installed it on my VM, and tried to import it with aws ec2 import-image, without success:

 "Status": "deleting",
 "StatusMessage": "ClientError: Unsupported kernel version 5.3.0-1023-aws",

However, even though the original motivation is moot, I am still interested in the original question: how to discover the kernel of Amazon AMIs.

mitchus
  • 213
  • 1
  • 7
  • 4
    Does this answer your question? [What Linux Kernel Versions are Acceptable for AMI Import to Amazon Web Services?](https://serverfault.com/questions/776636/what-linux-kernel-versions-are-acceptable-for-ami-import-to-amazon-web-services) – Michael Hampton Jul 03 '20 at 16:01
  • @MichaelHampton no, I checked that question, but as far as I could tell nobody had figured out how to list supported kernels. My idea is to identify which kernels have already been successfully imported (so a subset of supported kernels) – mitchus Jul 03 '20 at 16:05
  • That q&a contains the [link](https://docs.aws.amazon.com/vm-import/latest/userguide/vmie_prereqs.html#vmimport-operating-systems) to the list of supported operating systems for import. I don't think AWS provides any more information on that. – Henrik Pingel Jul 07 '20 at 14:34
  • @HenrikPingel thanks for the link, but it does not contain information about which kernels are supported. – mitchus Jul 07 '20 at 17:36

1 Answers1

1

Not sure how to check the kernel version of an AMI before you actually create an instance.

After creating an instance you can check with hostnamectl :
(works on Ubuntu as well as Amazon Linux 2)

$ hostnamectl

   Static hostname: xxxxxxxxxx
         Icon name: computer-vm
           Chassis: vm
        Machine ID: ec2xxxxxxxx
           Boot ID: xxxxxxxxxxx
    Virtualization: amazon
  Operating System: Amazon Linux 2
       CPE OS Name: cpe:2.3:o:amazon:amazon_linux:2
            Kernel: Linux 4.14.248-189.473.amzn2.x86_64
      Architecture: x86-64
Lou1973
  • 11
  • 1