Adjusting disk size Windows Opsworks instances

At One Model we use AWS Opsworks and Chef to manage our servers. I had to increase the disk size of some Windows instances, but didn’t know how. The following is what I learnt.

I’ll start with the simple case. If you are using the standard version of the OS provided by AWS (i.e. not a custom AMI) all you have to do is start some instances with the desired size.

standard-ami

If, like us at One Model, you are using a custom AMI for the OS it is more complicated. You need to complete a circuit of launching multiple instances from AMIs to end up with a final AMI with the desired disk size. The steps to increase the volume size follow.

Note: I haven’t tried it, but for shrinking I think you will have to do steps 5 and 6 after step 1 (before step 2) to shrink the drive in the OS first before reducing the AMI’s volume size.

  1. Launch an EC2 instance from your custom AMI.
  2. When the instance has launched create an AMI from it, setting the disk size to the desired size. This will not increase the size of the disk in the OS, but we need this intermediate AMI so that we can create an instance with access to a larger disk.
  3. Once the intermediate AMI has created terminate the instance it was created from.

    create-ami

  4. Launch an instance from the intermediate AMI.
  5. When it is ready, connect to the new instance through RDP.
  6. If you open Windows explorer you will notice that the disk size in the OS is unchanged, e.g. if you increased the root volume from 30GiB to 50GiB C drive in the OS will still have a max volume of 30GiB. Use Windows disk management to adjust the volume of the drive.
  7. Follow these instructions (Create a Custom Windows AMI with/without Sysprep) to prepare the instance to run as a custom AMI in Opsworks.
  8. Create a final AMI from the instance.
  9. When the final AMI has finished creating you can deregister the intermediate AMI and terminate the intermediate EC2 instance.

This final AMI can now be used to create new Opsworks instances.

It may be tempting to skip launching the first EC2 instance (step 1) by creating the intermediate image from an instance you already have running in Opsworks, but if you do this the AMI will have any additional changes that have been made (e.g. anything Chef may have done) and will not be as clean as the original custom AMI.

I hope this has helped you. Let me know in the comments if this doesn’t work for you.

Advertisements
Adjusting disk size Windows Opsworks instances