How Amazon VM Import Validates Kernel Version

amazon-web-servicescentoskernel

I'm trying to import a Centos 7.6-1810 VM with the latest stable kernel on Amazon, but the import process fails with the following error:

$ aws ec2 describe-import-image-tasks    
{
        "Status": "deleted",
        "SnapshotDetails": [
            {
                "Status": "completed",
                "UserBucket": {
                    "S3Bucket": "my-bucket",
                    "S3Key": "packer-import-xxxxxxx.ova"
                },
                "DiskImageSize": 1576340992.0,
                "Format": "VMDK"
            }
        ],
        "StatusMessage": "ClientError: Unsupported kernel version 5.0.8-1.el7.elrepo.x86_64",
        "ImportTaskId": "import-ami-xxxxxxxxx"
    }

I know the VM Import/Export Requirements, but it is not so clear about the CentOS supported kernel versions:

The following operating systems can be imported to and exported from Amazon EC2:

  • Red Hat Enterprise Linux (RHEL) 5.1-5.11, 6.1-6.9, 7.0-7.6 (6.0 lacks required drivers)
  • CentOS 5.1-5.11, 6.1-6.6, 7.0-7.6 (6.0 lacks required drivers)

Imported Linux VMs should use default kernels for best results. VMs that use custom Linux kernels might not migrate successfully.

My question is:

  • How Amazon identifies the Kernel version during the VM import process?
  • Can I assume that only the default CentOS kernel versions are supported? Or the problem is that I'm using an Elrepo kernel package?
  • There is a way to overcome this and use at least the 3.16.65 longterm kernel version? (which contains the latest security fixes).

Best Answer

AWS has not provided a complete list of acceptable kernels for several years now. Despite having specific acceptable minor releases of distros as prerequisites. So it might not be able to comprehend a RHEL 7 instance with a kernel that isn't 3.10. See Server Fault circa 2016: What Linux Kernel Versions are Acceptable for AMI Import to Amazon Web Services?

Remove your third party kernels, and add them back after import.

This is merely speculation, but it is not difficult to inspect the file system on a disk image. The distros store their bootloaders and kernels with predictable file names.