HashiCorp Packer builds identical machine images for multiple platforms from a single template. The template defines builders, provisioners and post-processors. Builders set where the image is built, such as AWS, Azure, GCP, Docker or Vagrant. Provisioners such as Shell, Ansible or PowerShell configure the machine. Post-processors package, upload or convert the finished image.

Posts under the Packer tag start with installation on Mac, Windows, Ubuntu and CentOS and an overview of the Packer workflow. Reference posts cover commands, provisioners, post-processors and every place you can set variables. Hands-on tutorials show how to build a Vagrant box, overwrite an existing AWS AMI with force_deregister and force_delete_snapshot, and pull values from AWS Secrets Manager and SSM Parameter Store with Amazon plugin data sources. A certification study guide and 50 interview questions, drawn from real build problems, complete the set.

These posts help DevOps and platform engineers who build golden images for the cloud or for virtualization, and anyone preparing for a Packer interview. Packer is usually one part of a wider infrastructure as code toolchain.

Start here

Latest Packer articles

Packer Tutorials: Amazon Secrets Manager Data Source – amazon-secretsmanager

The Amazon plugin is able to fetch data from AWS. To achieve this, the plugin comes with data sources to retrieve AMI and secrets information. Packer supports…

Read More

Packer Tutorials: Amazon Data Sources – amazon-parameterstore

The Amazon plugin is able to fetch data from AWS. To achieve this, the plugin comes with data sources to retrieve AMI and secrets information. Packer supports…

Read More

Packer Tutorials: Packer Install and configurations

Mac Windows https://releases.hashicorp.com/packer/1.8.6/packer_1.8.6_windows_amd64.zip Step 1 – Download and Extract at c:/tools/packer Step 2 – Add “c:/tools/packer” into env PATH variable Ubuntu Centos Rajesh KumarI’m Rajesh Kumar, a…

Read More

Packer Tutorials: Hashipcorp Packer workflow

The workflow for using HashiCorp Packer typically involves the following steps: Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing…

Read More

Packer Tutorials: Packer Commands reference with its use cases & Example

HashiCorp Packer is a tool for creating machine images that can be used with various cloud providers, virtualization platforms, or container systems. Here are some of the…

Read More

Packer Tutorials: List of Provisioner in hashicorp packer Post-processors

In HashiCorp Packer, post-processors are used to perform additional actions after the machine image has been created by the builder and provisioners. These actions can include compressing…

Read More

Packer Tutorials: List of Provisioner in Hashicorp Packer?

HashiCorp Packer is a tool for creating machine images that can be used with various cloud providers, virtualization platforms, or container systems. In addition to the builders,…

Read More

Packer Tutorials: List of Builder in Hashicorp Packer?

HashiCorp Packer is a tool for creating machine images that can be used with various cloud providers, virtualization platforms, or container systems. Packer uses a builder to…

Read More

Hashicorp Packer: What are the Location we can set variable

There are two kinds of variables in HCL Packer templates: Input variables, sometimes simply called “variables”, and Local variables, also known as “locals”. Input variables may have…

Read More

Hashicorp Packer Example Program: AWS AMI

Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked…

Read More

Hashicorp Packer Tutorial: Creating Vagrant Box

Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked…

Read More

Hashicorp Packer Tutorial: Creating Azure Vm Image

Create Azure resource group Build Packer image Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences,…

Read More

Complete Hashicorp Packer Certification Guide & tutorials

What is Hashicorp Packer? Packer is a Hasicorp’s tool started in 2013 and was the first project attempted at Hashicorp. HashiCorp Packer is open-source tool for building…

Read More

Top 50 Packer interview questions and answers

Q. Is it possible to feed packer with an ansible encrypted file? I’m attempting to use packer from an ansible playbook in order to use an ansible-vault…

Read More

Quick Tutorials of Hashicorp Packer

Packer AWS – Builders & Provisionars – aws-ubuntu.pkr.hcl Rajesh KumarI’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world…

Read More

How to overwrite Existing AWS EC2 AMI with Packer?

USING FORCE_DEREGISTER ADDED IN V1.1.2, IT WAS VERIFIED WHETHER AWS EC2 AMI CAN BE OVERWRITTEN. THE PROCESS IS TO DELETE THE AMI WITH THE SAME NAME AND…

Read More

Create AWS AMI policy, IAMgGroup and IAM user for Hashicorp Packer

This tutorails helps you to create a AWS AMI policy, IAMgGroup and IAM user for Hashicorp Packer execution so Packer should get only needed access than all….

Read More

Packer: frequently asked questions

What is Packer used for?

Packer builds machine images from code, such as AWS AMIs, Azure and GCP images, Docker images and Vagrant boxes. The same template builds the same image every time.

What is the difference between Packer and Terraform?

Packer creates machine images. Terraform provisions and manages the infrastructure that runs them. Teams often build an image with Packer and then deploy it with Terraform.

Should Packer templates be written in JSON or HCL?

Packer supports both legacy JSON templates and HCL2 templates (.pkr.hcl), and HCL2 is the recommended format in current releases. The packer hcl2_upgrade command converts a JSON template to HCL2.

How do I overwrite an existing AMI with Packer?

In the Amazon EBS builder, set force_deregister to true to deregister an existing AMI with the same name. Also set force_delete_snapshot to true to delete its snapshots.