If you use AWS_DISK_SIZE, it adds an EBS VolumeMapping to the new size.
Unfortunately, while Ubuntu (which would have been MY preference) uses /dev/sda1, Amazon Linux uses /dev/xda1 and the net result is that you end up with a second volume rather than enlarging the first one.
This code tries to get around that by querying the AMI (after it has been configured) and getting the root device name from the AMI definition. When you pass it in this way, the image ends up on that disk rather than creating a second volume for the instance.
I tested this on our Amazon Linux (yeah, I know....) image and it works fine, but I haven't written much go in the past year so please let me know if there are any changes you would like to see!
If you use AWS_DISK_SIZE, it adds an EBS VolumeMapping to the new size.
Unfortunately, while Ubuntu (which would have been MY preference) uses
/dev/sda1
, Amazon Linux uses/dev/xda1
and the net result is that you end up with a second volume rather than enlarging the first one.This code tries to get around that by querying the AMI (after it has been configured) and getting the root device name from the AMI definition. When you pass it in this way, the image ends up on that disk rather than creating a second volume for the instance.
I tested this on our Amazon Linux (yeah, I know....) image and it works fine, but I haven't written much go in the past year so please let me know if there are any changes you would like to see!