Domanda

I have a little problem with my aws autoscaling. I have my AMI ready and I also have created the launch configuration. I bind my configuration with the autoscaling group. Everything seems to work fine, but then I get the following error report:

Launching a new EC2 instance. Status Reason: Missing virtual name for block device mapping. Launching EC2 instance failed.

I can create an instance of this AMI and it's ok, but with autoscaling does not work. This instance is instance store based, so we don't use any EBS. Maybe I miss something?

È stato utile?

Soluzione

Most likely this is happening because you are building your instance store image on a different instance type than your final autoscale target. I have experienced the exact same scenario when creating an instance image on an m1.small and then trying to launch an m3.large.

This is occurring because the process of bundling and registering and instance AMI grabs the block device mapping from the host VM (in my case the m1.small) and encodes it as xml in the image manifest. This most likely references multiple ephemeral virtual volumes (epehemeral0, ephemeral1, etc.). When this AMI is then launched during an autoscaling action using a instance type that does not have the same corresponding volumes, you receive this error message.

As you mentioned, it will launch fine as a stand alone VM (not part of autoscaling). Something AWS does appears to compensate for this mis-match in user triggered launch of an instance AMI.

The solution is to explicitly set the block device mapping to match your intended instance type when you are creating the AMI.

Read more about block device mapping here:(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html)

Then use the ec2-bundle-vol command with the --block-device-mapping flag to tell the tool to ignore the host VMs current block devices.

The command that worked for me is below (image created on m1.small and autoscaled on m3.large) :

ec2-bundle-vol <lots of other flags snipped> --block-device-mapping ami=sda1,root=/dev/sda1,ephemeral0=sdb,swap=sda3
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top