In this article we discuss how to upload and use Microsoft Windows client operating systems in Amazon Web Services. Unfortunately, there are no pre-canned images with Microsoft Windows client operating systems in AWS. However, this does not mean that one cannot use them in Amazon’s EC2. Although it is trickier than just attaching an ISO image to a VM as one does when using a local virtualization environment, it does not require a lot of effort other than time. Below are the steps how to add a custom image to AWS.
Step 1: Download and install a virtualization environment, example Oracle Virtual Box or Windows Hyper-V.
Step 2: Create a new VM and ensure that you select VHD as the disk image format.
Step 3: Attach your ISO image to the new VM (created in step 2) and perform any configuration you want to do. Make sure that you have the following settings:
- Remote Desktop turned on.
- Firewall has exception rules to allow RDP.
- Install .NET Framework 3.5 or later. This is required by EC2 Configuration Service.
- NOTE: Windows 8.1 and 10 32-bit versions are not supported by AWS.
Step 4: Once all is set, shutdown the machine.
Step 5: Create a vmimport role and policy in IAM (details: http://docs.aws.amazon.com/vm-import/latest/userguide/import-vm-image.html)
Step 6: Next you need to upload the vhd to an S3 bucket
Example: Z:\VDisks>aws s3 cp .\JD_Win8.1x64.vhd s3://jd-machine-images/ Completed 5.7 GiB/9.3 GiB with 1 file(s) remaining
Step 7: Create a json file describing the disk containers.
Example: win8.1x64.json: [ { "Description": "Windows 8.1 Enterprise 64bit", "Format": "vhd", "UserBucket": { "S3Bucket": "jd-machine-images", "S3Key": "JD_Win8.1x64.vhd" } }]
Step 8: Import image to EC2 using aws cli tools.
Example: aws ec2 import-image --description "Windows 8.1 Enterprise 64-bit" --disk-containers file://win8.1x64.json
Step 9: Monitor the progress using aws ec2 describe-import-tasks command.
Example: aws ec2 describe-import-image-tasks --import-task-ids import-ami-ffl7m34q
Step 10: Once the image is imported in EC2 infrastructure, then it it ready for your use. If you want to spin multiple instances of the image, then you need to run EC2Config and sysprep the machine. Choose the option to shutdown the machine once sysprep is complete. When the machine shuts down, go to AWS Management Console and create an image. The last image is the final image you need to spin multiple instances of the OS you just uploaded.