Bundle the AMI
Log in to the Windows instance and customize it as desired.
In order to reduce the startup time, delete any temporary files on the instance using the Disk Cleanup tool, defragment your system using Disk Defragmenter, and zero out free space using sdelete -c C:.
On a computer where the API tools are installed, enter the following command:
ec2-bundle-instance <instance_id> -b <bucket_name> -p <bundle_name> -o <access_key_id> -w <secret_access_key>
<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 so you can launch at any time in the future, then restarts it.
ec2-bundle-instance i-69e8bc83 -b ami_images -p Web_Server_v3.5 -o W83UL9G462ZN7EAK -w S8QDx7zT6j5J2sM3fwG4v3=+=xq7sg5AeDzQ2rtZ4bW
Monitoring AMI Bundling
Bundling the AMI can take up to 30 minutes so be patient. You can view the status with:
Registering the AMI
Once the bundling is complete you must register the AMI, so Amazon EC2 can locate it and run instances based on it.
Note: If you make any changes to the source image stored in Amazon S3, you must re-register the image.
Amazon EC2 returns an AMI identifier, the value next to the IMAGE tag (ami-e597b4382 in the example) that you can use to run new instances with this new AMI.