Tuesday, June 12, 2012

Create a Larger Boot Disk Amazon Linux AMI

I know these last couple posts don't have a lot to do with sipXecs but I thought I'd share a few of the Amazon AWS tips I've been accumulating.

Sometimes you just need more than the 8 GB EBS volume that Amazon provides with Amazon Linux.  Sure you can just create another volume and attach it somewhere, but sometime it’s just easier to have one big drive.

The following instructions are used to create a 64 bit Amazon Linux AMI with a boot drive up to 1 TB in size.

Servers can then be rapidly deployed from your new custom AMI.

Create Base System

Starting from
AMI:amzn-ami-pv-2012.03.1.x86_64-ebs (ami-e565ba8c)

Launch a new instance.

If you’d like, login and update system
SSH to new Instance with key, login as ec2-user
sudo sh
yum update
shutdown -h now

Build AMI

In EC2 console create a snapshot of the root EBS volume.

Create an ESB volume from that snapshot with the new desired size. (Please ensure it is in the same Availability Zone as the instance)

Detach the root 8 GB EBS volume and attach the newly created EBS volume to /dev/sda1 on the instance.

Start the instance and then login.

Resize the disk to get the rest of the expanded disk
sudo resize2fs /dev/sda1

From the EC2 console, click on the Instance and Create AMI from the running Instance.

There you have it!

1 comment:

Michael Picher said...

Hey, it's about time, no need to do this anymore for Amazon Linux images! You can set the boot volume size and also set to attach other volumes when creating a new instance! After boot you need to: sudo resize2fs /dev/sda1