Skip to content

How do I use Sysprep to create and install custom reusable Windows AMIs?

4 minute read
0

I want to use System Preparation (Sysprep) to capture and install a custom reusable Windows Amazon Machine Image (AMI).

Resolution

When you run Sysprep, use the following best practices:

  • Don't use Sysprep to create a backup for your instance.
  • Don't run Sysprep on a production system.
  • Windows Server 2016 Nano Server doesn't support Sysprep.
  • For Windows Server 2008 through Windows Server 2012 R2, run Sysprep with EC2Config.
  • For Windows Server 2016 or Windows 2019 (LTSC and SAC), run Sysprep with EC2Launch v1.
  • For Windows Server 2022 and Windows Server 2025, run Sysprep with EC2Launch v2. You can also use EC2Launch v2 for Windows 2012, 2012 R2, 2016 (LTSC and SAC), or 2019 (LTSC and SAC).

Note: For more information, see Limitations on the Microsoft website. To capture a Sysprep image of a production system, create an AMI from the instance. Then, launch the instance from the AMI in an isolated environment. You can capture a Sysprep image of the launched instance.

Run Sysprep with EC2Config or EC2Launch v1 or v2

Complete the following steps:

  1. Open the Amazon Elastic Compute Clouse (Amazon EC2) console.
  2. Use Remote Desktop Protocol (RDP) to connect to your Windows instance.
  3. Choose the Windows Start menu, and then complete one of the following steps for the Windows Server that you use:
    For Windows Server 2008 through Windows Server 2012 R2, open EC2ConfigService Settings, and then choose Image.
    For Windows Server 2016 or later, open EC2LaunchSettings.
  4. For Administrator Password, choose Random.
  5. Choose Shutdown with Sysprep, and then choose Yes.
    Note: You must retrieve the new password from the console the next time that you boot.
  6. Open the Amazon EC2 console.
  7. In the navigation pane, choose Instances.
  8. After the instance state changes to stopped, select your instance.
  9. For Actions, choose Image, and then choose Create image.
  10. For Image name, enter a name.
  11. For Image description, enter a description.
  12. Choose Create image.

For more information and customization options, see Create an Amazon EC2 AMI using Windows Sysprep.

If you receive error messages, then see Troubleshoot Sysprep issues with Amazon EC2 Windows instances. You can also use EC2Rescue for Windows Server to collect log files and troubleshoot any issues.

Sysprep limitations with SQL Server

You can't run Sysprep on an EC2 instance that already has a SQL Server installed. To create a reusable image of a SQL Server instance, use one of the following options.

Use SQL Server's image preparation workflow

Install SQL Server with the Prepare Image of a Stand-Alone Instance of SQL Server option. Run Sysprep, and then run Complete Image of a Prepared Stand-Alone Instance of SQL Server on each launched instance to finish the installation. For more information, see Install SQL Server with SysPrep on the Microsoft Learn website.

Create the AMI without Sysprep

Complete the following steps:

  1. Create the image directly from the instance.
  2. Launch a new instance.
  3. Correct the SQL Server name. Run sp_dropserver for the old name and sp_addserver for the new name with the local option. Then restart the SQL Server service so that @@SERVERNAME matches the new host name. For more information, see Rename a computer that hosts a stand-alone instance of SQL Server on the Microsoft Learn website.

Note: On official AWS Windows AMIs, EC2Launch v2 assigns a unique computer name at launch, but it doesn't regenerate the Windows machine security identifier (SID). If your custom AMI wasn't generalized with Sysprep, then instances launched from it share the same machine SID, which can cause problems for domain joins, WSUS, and other services that require a unique SID.

Related information

Why can't I launch EC2 instances from my copied AMI?

AWS OFFICIALUpdated 19 days ago
4 Comments

If the goal is to create good images from EC2 Instances in production then why do you recommend not using Sysprep in production system?

replied 3 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
MODERATOR

replied 3 years ago

I followed these exact steps but when launching an image from my custom AMI, I cannot RDP into it.

replied 2 years ago

This article was reviewed and updated on 2026-10-26.

EXPERT

replied 18 days ago