> ## Content Index
> Fetch the complete content index at: https://horrell.ca/llms.txt
> Use this file to discover other available public pages before exploring further.

# Building Windows AMIs with Packer
- URL: https://horrell.ca/2026/06/10/building-windows-amis-with-packer/
- Published: 2026-06-10T15:02:08.000Z
- Updated: 2026-10-02T14:16:19.000Z
- Author: Christopher Horrell
- Tags: aws, packer, ami, windows

Building a Windows AMI ([Amazon Machine Image](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html?ref=horrell.ca)) with [Packer](https://developer.hashicorp.com/packer?ref=horrell.ca) used to be pretty painful. Traditionally, you had to use the [WinRM](https://developer.hashicorp.com/packer/docs/communicators/winrm?ref=horrell.ca) communicator and it's...not the best experience. Generally, WinRM is slow, unreliable and there's a bunch of steps you need to take to ensure the image is secure. Not great! On top of that, provisioning a Windows instance on AWS was a lot slower than a Linux instance. Put all that together and Windows image builds were quite the grind. Iterating was slow and I would often spend 20-40 minutes waiting on a build just to find out the image was broken in some way.

But things have gotten better! Over the last few years, there's been a few changes that have made this a lot less painful:

- OpenSSH on Windows
- EC2 Fast Launch

## OpenSSH on windows

Back in 2018 or so, Microsoft ported [OpenSSH to Windows](https://github.com/PowerShell/Win32-OpenSSH?ref=horrell.ca) which meant you could use the [ssh communicator](https://developer.hashicorp.com/packer/docs/communicators/ssh?ref=horrell.ca) in Packer instead, a faster and more secure alternative. Following this [post](https://jen20.dev/post/windows-amis-with-even-fewer-tears/?ref=horrell.ca) by a former Joyent colleague, I started using this approach for building Windows AMIs at [Nymi](https://www.nymi.com/?ref=horrell.ca). 

Things improved a bit more since that blog post and you can now install OpenSSH fairly easily via [Add-WindowsCapability](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh%5Finstall%5Ffirstuse?tabs=powershell&ref=horrell.ca#install-openssh-for-windows). 

## EC2 Fast Launch

Sometime in 2022, AWS introduce [EC2 Fast Launch](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/win-ami-config-fast-launch.html?ref=horrell.ca) which significantly reduces Windows instance launch time. They claim launches are 65% faster, and it certainly feels that way. This speeds up Packer builds by quite a bit, and iterating on an image is way less painful. Even better, you can enable Fast Launch in your Packer template so your custom Windows instances will launch pretty quickly as well.

## A Packer Template for Windows AMIs

With all those recent improvements, I created a reference Packer template on GitHub: 

- [Windows AMI with ssh](https://github.com/chorrell/packer-aws-windows-openssh?ref=horrell.ca)

This template is based on the solid groundwork [here](https://github.com/jen20/packer-aws-windows-ssh?ref=horrell.ca) but with a few updates:

- The Packer template `aws-windows-ssh.pkr.hcl` is coded in HCL2 rather than JSON.
- OpenSSH is installed with `Add-WindowsCapability`
- The template enables Fast Launch for the AMI (`enable_fast_launch = true`)

The image build times are much more reasonable! 

Hopefully this will be helpful to anyone else who needs to build a Windows image and makes things a little easier.