100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
DevOps

Packer

By HashiCorp

IntermediateTool10.3K learners

Packer is a HashiCorp tool that automates the creation of identical machine images for multiple platforms — such as AWS AMIs, Docker images, and VM templates — from a single declarative configuration file.

Definition

Packer is a HashiCorp tool that automates the creation of identical machine images for multiple platforms — such as AWS AMIs, Docker images, and VM templates — from a single declarative configuration file.

Overview

Packer lets infrastructure teams define a machine image once, in a JSON or HCL configuration, and build that same image for multiple targets — including Amazon EC2, Azure, Google Cloud, VMware, and container formats — through pluggable builders. This eliminates the drift that happens when images are hand-configured separately for each cloud or virtualization platform, and pairs naturally with infrastructure-as-code tools like Terraform, which can then provision instances from the images Packer produces. A typical Packer build starts from a base image, boots a temporary instance, applies provisioning steps (shell scripts, Ansible playbooks, or other configuration tools), and then captures the result as a reusable image artifact before tearing the temporary instance down. This produces “golden images” that are immutable, versioned, and consistent across environments — a common pattern for reducing configuration drift and speeding up deployment, since new instances boot from a fully baked image rather than running setup scripts at launch time. Packer is widely used alongside other HashiCorp tools in DevOps pipelines, particularly in organizations practicing immutable infrastructure, where servers are replaced rather than patched in place. It's a natural companion topic to courses on Terraform & Infrastructure as Code.

Key Features

  • Single configuration file that builds images for multiple platforms
  • Pluggable builder architecture supporting major clouds and virtualization tools
  • Integration with provisioners like shell scripts and Ansible
  • Produces immutable, versioned 'golden images' for consistent deployments
  • Works alongside Terraform for full infrastructure-as-code workflows
  • Parallel builds across multiple target platforms from one template

Use Cases

Building consistent AMIs for auto-scaling groups on AWS
Creating golden VM images for on-premises virtualization platforms
Baking application dependencies into images to speed up deployment
Standardizing base images across multiple cloud providers
Reducing configuration drift in immutable infrastructure setups
Automating image builds as part of a CI/CD pipeline

Frequently Asked Questions