Creating an Amazon EBS-Backed Windows AMI
To create an Amazon EBS-backed Windows AMI, you launch and customize a Windows instance, then you create the AMI.
If you need to create an Amazon EBS-backed Linux AMI, see Creating an Amazon EBS-Backed Linux AMI in the Amazon EC2 User Guide for Linux Instances.
The AMI-creation process is different for instance-store-backed AMIs. For more information about the differences between Amazon EBS-backed and instance-store-backed instances, and how to determine the root device type for your instance, see Root Device Volume. If you need to create an instance store-backed Windows AMI, see Creating an Instance Store-Backed Windows AMI.
Overview of Creating Amazon EBS-Backed AMIs
First, launch an instance from an AMI that's similar to the AMI that you'd like to create. You can connect to your instance and customize it. When the instance is set up the way you want it, ensure data integrity by stopping the instance before you create an AMI and then create the image. When you create an Amazon EBS-backed AMI, we automatically register it for you.
During the AMI-creation process, Amazon EC2 creates snapshots of your instance's root volume and any other EBS volumes attached to your instance. If any volumes attached to the instance are encrypted, the new AMI only launches successfully on instances that support Amazon EBS encryption. For more information, see Amazon EBS Encryption.
Depending on the size of the volumes, it can take several minutes for the AMI-creation process to complete (sometimes up to 24 hours).You may find it more efficient to create snapshots of your volumes prior to creating your AMI. This way, only small, incremental snapshots need to be created when the AMI is created, and the process completes more quickly (the total time for snapshot creation remains the same). For more information, see Creating an Amazon EBS Snapshot.
After the process completes, you have a new AMI and snapshot created from the root volume of the instance. When you launch an instance using the new AMI, we create a new EBS volume for its root volume using the snapshot. Both the AMI and the snapshot incur charges to your account until you delete them. For more information, see Deregistering Your AMI.
If you add instance-store volumes or Amazon EBS volumes to your instance in addition to the root device volume, the block device mapping for the new AMI contains information for these volumes, and the block device mappings for instances that you launch from the new AMI automatically contain information for these volumes. The instance-store volumes specified in the block device mapping for the new instance are new and don't contain any data from the instance store volumes of the instance you used to create the AMI. The data on EBS volumes persists. For more information, see Block Device Mapping.
Creating a Windows AMI from a Running Instance
You can create an AMI using the AWS Management Console or the command line. The following diagram summarizes the process for creating an Amazon EBS-backed AMI from a running EC2 instance. Start with an existing AMI, launch an instance, customize it, create a new AMI from it, and finally launch an instance of your new AMI. The steps in the following diagram match the steps in the procedure below. If you already have a running Amazon EBS-backed instance, you can go directly to step 4.
To create an AMI from an instance using the console
Select an appropriate EBS-backed AMI to serve as a starting point for your new AMI. To view the EBS-backed Windows AMIs, choose the following options from the Filter lists: Public images, EBS images, and then Windows.
You can select any public AMI that uses the version of Windows Server that you want for your AMI. However, you must select an EBS-backed AMI; don't start with an instance store-backed AMI.
Choose Launch to launch an instance of the EBS-backed AMI that you've selected. Accept the default values as you step through the wizard. For more information, see Launching an Instance.
While the instance is running, connect to it.
You can perform any of the following actions on your instance to customize it for your needs:
Install software and applications
Reduce start time by deleting temporary files, defragmenting your hard drive, and zeroing out free space
Attach additional EBS volumes
Create a new user account and add it to the Administrators group
If you are sharing your AMI, these credentials can be supplied for RDP access without disclosing your default administrator password.
Configure settings using EC2Config. If you want your AMI to generate a random password at launch time, you need to enable the
Ec2SetPasswordplugin; otherwise, the current administrator password is used. For more information, see Configuring a Windows Instance Using the EC2Config Service.
If the instance uses RedHat drivers to access Xen virtualized hardware, upgrade to Citrix drivers before you create an AMI. For more information, see Upgrading PV Drivers on Your Windows AMI .
(Optional) When the instance is configured correctly, it is best to stop the instance before you create the AMI, to ensure data integrity. You can use EC2Config to stop the instance, or select the instance in the Amazon EC2 console and choose Actions, Instance State, Stop.
In the navigation pane, choose Instances and select your instance. Choose Actions, Image, and Create Image.
If this option is disabled, your instance isn't an Amazon EBS-backed instance.
In the Create Image dialog box, specify values for the following fields, and then choose Create Image.
A unique name for the image.
(Optional) A description of the image, up to 255 characters.
By default, Amazon EC2 shuts down the instance, takes snapshots of any attached volumes, creates and registers the AMI, and then reboots the instance. Choose No reboot if you don't want your instance to be shut down.
If you choose No reboot, we can't guarantee the file system integrity of the created image.
You can modify the root volume, Amazon EBS volumes, and instance store volumes as follows:
To change the size of the root volume, locate the Root volume in the Type column, and fill in the Size field.
To suppress an Amazon EBS volume specified by the block device mapping of the AMI used to launch the instance, locate the EBS volume in the list and choose Delete.
To add an Amazon EBS volume, choose Add New Volume, Type, and EBS, and fill in the fields. When you then launch an instance from your new AMI, these additional volumes are automatically attached to the instance. Empty volumes must be formatted and mounted. Volumes based on a snapshot must be mounted.
To suppress an instance store volume specified by the block device mapping of the AMI used to launch the instance, locate the volume in the list and choose Delete.
To add an instance store volume, choose Add New Volume, Type, and Instance Store, and select a device name from the Device list. When you launch an instance from your new AMI, these additional volumes are automatically initialized and mounted. These volumes don't contain data from the instance store volumes of the running instance from which you based your AMI.
While your AMI is being created, you can choose AMIs in the navigation pane to view its status. Initially, this is
pending. After a few minutes, the status should change to
(Optional) Choose Snapshots in the navigation pane to view the snapshot that was created for the new AMI. When you launch an instance from this AMI, we use this snapshot to create its root device volume.
Launch an instance from your new AMI. For more information, see Launching an Instance. The new running instance contains all of the customizations you applied in previous steps.
You can specify scripts to execute when an instance starts. You enter the script in the User data section of the Instance Configuration Wizard. For example, you could specify a PowerShell script to rename an instance when it starts. For more information, see Configuring Instances with User Data.
To create an AMI from an instance using the command line
You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.