HashiCorp is at the forefront of the industry-wide movement toward Infrastructure as Code (IaC). It typically utilizes a JSON language, through which provisioners are defined to our machine images. Apart from JSON, a combination of YAML and Go can also be used to build consistent images across a variety of platforms. Along with provisioners, builders and post-processors are also integral to Packer, the details of which are provided in the table below:
Provisioner | Builder | Post-Processor |
Configures the image after it's been built. | Packer builds on the base images made from the builder. | Further modifications after the machine image is built and provisioned. |
Can use shell scripts or external tools like PowerShell or Chef. | Typically integrates with third-party platforms such as Azure, Google Cloud, and many more. | Supports various platforms such as VMware and VirtualBox. |
Prepares for image deployment by defining settings and running scripts to install necessary packages. | Adds specifications (e.g., instance type, authentication methods) to the created machine images. | Includes changes like compression methods for the image or converting it into a different format. |
We recommend using Linux with Packer, as Windows and macOS often have issues with obscure techniques and longer debugging times. The commands are given below:
apt install unzipwget https://releases.hashicorp.com/packer/1.9.1/packer_1.9.1_linux_amd64.zipunzip packer_1.9.1_linux_amd64.zipmv packer /usr/local/bin/packer version
The commands above are to install Packer in a Ubuntu environment. We can simulate these commands in the terminal below:
Free Resources