Bundling a Windows AMI
This section describes how to bundle an AMI in Windows. The bundling process does the following:
Compresses the image to minimize bandwidth usage and storage requirements
Encrypts and signs the compressed image to ensure confidentiality and authenticates the image against its creator
Splits the encrypted image into manageable parts for upload
sysprepto strip out computer specific information (e.g., the MAC address and computer name) to prepare the Windows image for virtualization
Creates a manifest file that contains a list of the image parts with their checksums
Before bundling an instance, you can configure the instance using the EC2Config service. For more information, see Windows Configuration Service
How to Bundle an AMI
Bundling your own AMIs allows you to make the most of Amazon EC2. Your AMIs become the basic unit of deployment which allow you to rapidly boot new custom instances as you need them.
All AMIs are loaded from Amazon S3 storage. You must upload the AMI to an existing account on Amazon S3.
Amazon S3 stores data objects in buckets, which are similar in concept to directories. You will need to specify a bucket name in the following example as <your-s3-bucket>. Buckets have globally unique names and are owned by unique users. If you have used Amazon S3 before, you can use any of your existing buckets or just give ec2-bundle-instance any name that makes sense to you. The ec2-bundle-instance utility uploads the bundled AMI to a specified bucket. If the specified bucket does not exist, it creates it. If the specified bucket belongs to another user, ec2-bundle-instance fails, and you have to try a different name.
For this, you will need your AWS Access Key ID (<aws-access-key-id>) and AWS Secret Access Key (<aws-secret-access-key>).
To bundle an AMI
Log in to the Windows instance and make any desired changes.
We highly recommend that you change the password of the AMI. If you use the Amazon EC2-provided password, write it down so you can access instances launched from this AMI. You cannot get the password of new instances using the
If you want to reduce your startup time, delete any temporary files on your instance using the Disk Cleanup tool, defragment your system using Disk Defragmenter, and zero out free space using
sdelete -c C:\.
On the host where you have installed the API tools, enter the following command:
<instance_id>is the name of the instance,
<bucket_name>is the name of the bucket in which to store the AMI, and
<bundle_name>is the common name for the files to store in Amazon S3.
Amazon EC2 shuts down the instance, saves it as an AMI, and restarts it. You can launch copies of the AMI at any time in the future.
ec2-bundle-instance i-eb977f82 -b
BUNDLE bun-e3a4418a i-eb977f82
myimage2008-10-02T09:31:44+0000 2008-10-02T09:31:44+0000 pending
How to Monitor a Bundled AMI
Before you launch an AMI, you must wait for the bundling to complete and then register it. The bundling task moves from the "pending" state, to the "bundling" state, to the "storing" state, and finally to the "complete" state.
To view the status
Enter the following command:
Amazon EC2 returns output similar to the following:
BUNDLE bun-e3a4418a eb977f82 mybucket winami complete 2008-08-28T00:59:13+0000 2008-08-28T01:34:30+0000
How to Register the AMI
Your must register your image with Amazon EC2, so we can locate it and run instances based on it.
If you make any changes to the source image stored in Amazon S3, you must re-register the image.
To register the AMI that Amazon EC2 created and uploaded to Amazon S3
Execute the following command:
Amazon EC2 returns an AMI identifier, the value next to the
ami-2bb65342in the example) that you can use to run instances.