
Description
Production runs on AWS, staging on VMware, laptops on VirtualBox — and the same base environment gets built by hand three times, with nobody able to swear the three are identical. That is exactly how "works on my machine" bugs survive. Packer turns it into one file: write the template once and it produces images for every platform in parallel, with the same packages, versions and configuration in each.
Templates are HCL and read plainly: a source says which base image to start from and where to output, provisioners say what to install once inside (raw shell, or hand it to Ansible, Chef or Puppet), post-processors say how to tag and where to ship the result. Because the installing happens at image-build time rather than at boot, instances come up in seconds and breakage surfaces during the build instead of in production.
One template, many targets: a single build block can list several sources — AWS AMI, Azure, GCP, VMware, VirtualBox, Docker — all fed by the same provisioners in one run.
HCL with variables: pull version numbers, regions and instance types out as variables passed on the command line or in a var file, so dev and prod images come from one template.
Provisioners reuse your tooling: shell scripts, file uploads, Ansible playbooks, Chef, Puppet and PowerShell all work as build steps, so configuration management is not rewritten.
Post-processors finish the job: tag a Docker image, produce a Vagrant box, compress an artifact or push to a registry automatically once the build succeeds.
Inspect before you burn money: packer inspect prints the template's variables, builds, provisioners and post-processors as a tree so you confirm the shape before anything spins up.
fmt and validate: fmt normalises formatting and can print just the diff, while validate checks syntax and references before a cloud instance is ever launched.
Plugin architecture: builders and provisioners are separate plugins declared with versions in required_plugins and fetched automatically; since 1.16 they can also come from non-GitHub mirrors and artifact repositories.
A single binary: one Go executable for Windows, macOS and Linux — unzip and run, nothing else to install in CI.
Templates are HCL and read plainly: a source says which base image to start from and where to output, provisioners say what to install once inside (raw shell, or hand it to Ansible, Chef or Puppet), post-processors say how to tag and where to ship the result. Because the installing happens at image-build time rather than at boot, instances come up in seconds and breakage surfaces during the build instead of in production.
Features
One template, many targets: a single build block can list several sources — AWS AMI, Azure, GCP, VMware, VirtualBox, Docker — all fed by the same provisioners in one run.
HCL with variables: pull version numbers, regions and instance types out as variables passed on the command line or in a var file, so dev and prod images come from one template.
Provisioners reuse your tooling: shell scripts, file uploads, Ansible playbooks, Chef, Puppet and PowerShell all work as build steps, so configuration management is not rewritten.
Post-processors finish the job: tag a Docker image, produce a Vagrant box, compress an artifact or push to a registry automatically once the build succeeds.
Inspect before you burn money: packer inspect prints the template's variables, builds, provisioners and post-processors as a tree so you confirm the shape before anything spins up.
fmt and validate: fmt normalises formatting and can print just the diff, while validate checks syntax and references before a cloud instance is ever launched.
Plugin architecture: builders and provisioners are separate plugins declared with versions in required_plugins and fetched automatically; since 1.16 they can also come from non-GitHub mirrors and artifact repositories.
A single binary: one Go executable for Windows, macOS and Linux — unzip and run, nothing else to install in CI.
