AWS EC2 – Attach Larger Volume with run-instances


I’m having difficulty launching an EC2 instance and increasing the size of the root partition in a single command with aws ec2 run-instances:

The instance launches, and I can see the new 120GB volume listed (though not as root) in the console, but then the instance immediately stops (not terminates). I’ve tried renaming the DeviceName property per these conventions, This is a temporary instance that I’m going to launch, do stuff, then terminate. Maybe I need to run create-volume first and then attach it with a separate series of commands? The AWS documentation seems to be all over the place on this and I can’t find a clear explanation, though I’ve come across a few links here and here. This SO question suggests resizing the partition but I’m not sure if that’s what I need to do. As far as I can tell, the m3.2xlarge instance type has EBS available. Am I naming the partition incorrectly? Is something in this configuration causing the stoppage of the instance?


After the instance stops itself, I get the follow as part of the response to describe-instances:


I think you’re running into the same problem that this SO question is having:

Your instance is an HVM instance and wants to use /dev/xvda as the root device. However, you’re specifying /dev/sda1. This is (a) creating a secondary volume instead, but then (b) preventing the instance from launching because that’s a PV-related device rather than HVM.

So, as a solution, use /dev/xvda as the device name instead. Like the following command line:

Leave a Reply