Immutable infrastructure
The concept of immutable infrastructure (Chad Fowler, 2013) replaces the “configure in place” model (Puppet/Chef/Ansible that modify existing servers) with a golden image model: build a complete image, deploy it identically everywhere, replace it instead of modifying it. Packer is the tool that makes multi-platform build standardised.
The release
Packer is published in June 2013 by Mitchell Hashimoto (HashiCorp cofounder, also Vagrant author). Stabilised 1.0 arrives on 4 April 2017. Written in Go, single binary. Originally MPL 2.0 licence; in 2023 HashiCorp changes to BUSL 1.1 (non-compete for commercial competitors).
How it works
A JSON/HCL file describes:
- Builders — target platforms (AWS EC2, Azure, GCP, VMware, VirtualBox, Docker, QEMU, OpenStack…)
- Provisioners — installation scripts (shell, Ansible, Puppet, Chef, file upload)
- Post-processors — final transformations (Vagrant box, Docker push, compress)
source "amazon-ebs" "ubuntu" {
ami_name = "my-app-{{timestamp}}"
instance_type = "t3.micro"
region = "eu-south-1"
source_ami = "ami-ubuntu-22.04"
ssh_username = "ubuntu"
}
build {
sources = ["source.amazon-ebs.ubuntu"]
provisioner "ansible" {
playbook_file = "./site.yml"
}
}
packer build template.pkr.hcl → AMI ready for deploy.
Advantages
- Parallelism — same image for AWS/Azure/GCP simultaneously
- Versioning — versioned AMIs, simple rollback
- Supply chain — CI builds with provenance
- Testing — images tested before deploy
- Immutable deploy — Auto Scaling Group with new AMI, no in-place update
Ecosystem
Often combined with:
- Terraform — infra provisioning that uses Packer images
- Ansible — as provisioner inside Packer
- Vagrant — for local dev environments
- GitLab CI / GitHub Actions — automated pipelines
Competitors
- EC2 Image Builder (AWS, 2019) — managed, vendor-specific
- Image Builder (Azure), Cloud Build (GCP) — analogous cloud-specific
- Disk Image Builder (OpenStack)
- Kiwi (SUSE)
- Docker Buildx — for containers, not VMs
In the Italian context
Packer is used in:
- Italian corporate cloud migrations (golden Linux/Windows images)
- MSPs with multi-cloud clients
- Banks/insurance for standard images with CIS hardening
- Digital PA — base images for PSN (National Strategic Pole) projects
- Reproducible dev environments with Vagrant on VMware/VirtualBox
References: Packer 1.0 (4 April 2017). HashiCorp, Mitchell Hashimoto. Original 2013. MPL 2.0 licence, BUSL 1.1 since 2023. Written in Go. Multi-cloud builders, Ansible/Puppet/shell provisioners.
