简体   繁体   中英

Example for 'aws ec2 import-image'

Try as I might, I cannot get the import-image task to work. I'm looking for a working example that I can reproduce, preferably starting with a "raw" disk image.

Most recent problems:

  • "Unsupported kernel version" when using an image that works fine when converted with the mouse instead of the API (posted to EC2 forum, no response: https://forums.aws.amazon.com/thread.jspa?threadID=221844 )

  • "No valid partitions" when using a VirtualBox VMDK image that boots just fine in VirtualBox.

I ran into a similar issue when I tried importing FreeBSD bundled OVAs to it. According to the pre-requisites/checklist, Amazon does not yet support vmimporting of FreeBSD. That produces the "No valid partitions". Also, if you use LUKS encrypted partitions it produced that same error for me, (Ubuntu).

For "Unsupported kernel version", here is my output of that same error:

c:\Users\XXXXX\Documents>aws ec2 describe-import-image-tasks --import-task-ids "import-ami-fgacu4yu"
{
 "ImportImageTasks": [
    {
        "Status": "deleted",
        "SnapshotDetails": [
            {
                "UserBucket": {
                    "S3Bucket": "myautomationbucket",
                    "S3Key": "ubuntu14.04-patched.ova"
                },
                "DiskImageSize": 843476480.0,
                "Format": "VMDK"
            }
        ],
        "Description": "Optimus Custom Ubuntu14.04",
        "StatusMessage": "ClientError: Unsupported kernel version 4.2.0-36-generic",
        "ImportTaskId": "import-ami-XXXXXXXX"
    }
]
}

According to AWS they posted a list of known good kernels however they are not verbose for my favorite flavor, Ubuntu.

http://docs.amazonaws.cn/en_us/AWSEC2/latest/WindowsGuide/VMImportPrerequisites.html

So what I had done is downgrade the kernel to their acceptable ones.

I obtained how to get what was "acceptable" by performing this command on an existing, known good running instance in my EC2:

c:\Users\XXXXXX\Documents>aws ec2 describe-instance-attribute --instance-id i-12345678 --attribute kernel --region us-east-1
{
"InstanceId": "i-12345678",
"KernelId": {
    "Value": "aki-825ea7eb"
}
}

So this aki-824ea7eb is the supported kernel ID. That isn't very helpful, so after some research I realized that AWS may only have a list of supported kernels due to the limitation of their existing platform -- they are not running ESXi you know. ;)

I had searched and found this to be useful and followed the instructions for 13.04 https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distributionsupplied-kernel-with-pvgrub

I performed 1,2,3,4, but I had skipped steps 5,6,7,8... performed 9 and then 15.

And then when I performed them on my VM, repackaged the VM to an OVA and ran my vmimport, it successfully imported with an instance.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM