How to Convert S3 Backed Windows AMIs to EBS Backed Windows AMIs

 

How to Convert S3 Backed Windows AMIs to EBS Backed Windows AMIs

 

Note: The preferred term for "S3-backed" is now "instance store-backed."

Introduction:

If you have Windows 2003 AMIs in the AWS environment, they are likely S3-backed, which of course means that they can’t be stopped and then restarted. (Windows 2008 is only available as EBS-backed AMIs, so these instructions don’t apply to them.)
Steps:

    Launch an instance of the S3-backed Windows AMI that you want to migrate
    Log into the instance and download dd.exe.  This is *nix tool that does block copying of raw devices.
        We tested with version dd-0.5 from this site: http://www.chrysocome.net/dd, although the newer version appers to work too.
    Create a 10GB EBS volume in the same AZ as the running instance and attach it to the running instance.
        You don't need to mount it or format it.  It will show up in the Disk Manager and the dd tool will see the raw device.
    Run a dd copy from the root disk to the mount EBS volume.  This is done on the running S3-backed instance.
    Once dd completes, detach the EBS volume from the S3-backed instance and note its volume id
    Launch an EBS-backed Basic Windows instance of the same bit size (32 or 64 bit) as your S3-backed AMI and in the same AZ. There are some EBS-backed Windows 2003 images available. Note that there is no reason to wait for a Windows  password, because it will be the same one as the image you just cloned. You did change it from whatever was assigned at startup, right?
    Stop the EBS-backed Windows instance
    Detach the EBS root volume from the EBS-backed Windows instance
    Attach the EBS volume that was cloned from the S3-backed root volume using DD. This needs to be attached as /dev/sda1
    Start the EBS-backed Windows instance
    Connect to the EBS-backed Windows instance and confirm that it works
        You should see the same tools and files on the S3-backed AMI
        The root filesystem will now be only 10GB

What next?

You might want to grow the root filesystem back to 30GB, which you can do by doing the following:

    Create a new image from this EBS-backed instance
    Launch the new image from the command line but specify a larger size for the root device using the block-device-mapping parameters
    Grow the filesystem in the Disk manager inside the Windows instance
    Re-bundle (or lose your conversion work once the instance is terminated!)

Are there other approaches that also work?

Maybe
, but here’s a couple that definitely won’t:

What about the command line tools?

You might have seen the ec2-download-bundle and ec2-unbundle commands and assumed that they work with Windows images.

Nope… The Ec2-unbundle command relies on an encrypted shared secret in the S3 image manifest, and in order to decrypt the bundle you need an X.509 certificate. For Linux images, this certificate is one that you hold; however for Windows AMIs, the encrypted the secret is paired with a X.509 Certificate that belongs to Amazon Web Services.

Could I just download the manifest parts from Amazon S3 and glue them together?

Once again the answer is “no”. That’s because the parts are encrypted using the certificate referenced above

Comments

Popular posts from this blog

Push command for NetWorker Client Upgrade

Factors Affecting Users’ Sense of Security and Trust in Integrating Electronic health record to the cloud

Basic Elastic Cloud Storage Troubleshooting Commands