Preface
As a frequent blogger of HashiCorp products, it’s an honor to present this more thorough exploration of the open source Packer tool. Packer is one of HashiCorp’s simplest and most elegant tools with one simple task. It builds images and artifacts in a consistent way for different environments and cloud projects. If you’re thinking of carrying out a lift-and-shift migration, there are a series of questions you may have:
- What operating system will you boot with?
- How will you apply updates and test patches across your development lifecycle?
- How can you ensure your on-premises images match the ones in your global cloud environments?
- What if you have multiple clouds to keep track of?
- How can you build matching container images for serverless environments or orchestration platforms?
These are the questions that Packer solves for most users. On the journey of writing this book, I went even deeper to try and show how Packer can do even more than it was built for. I wanted to answer the questions that people don’t think to ask about Packer. In addition to cloud environments, we’ll explore everything from the high-level basics of local environments to complex cloud image libraries. We’ll even push Packer further and experiment with some interesting use cases Packer hasn’t necessarily been positioned for. The questions you’ll be asking afterward may surprise you:
- Are your cloud applications prepared for ARM or RISC-V architectures to cut your compute costs in half?
- Can you run tests and compliance profiles as part of your automation pipelines?
- Can you build and test mobile apps along with your cloud images?
- Can you build and test your IoT devices and microcontrollers along with a cloud backend?
- Can Packer save you time on slow Terraform tasks?
The answers to these questions are surprising, and it turns out Packer can do every one of these things. It can replicate your local VMware environments in the cloud for lift-and-shift workloads. It can update your container image registry at the same time as it builds a virtual image or even a bare-metal environment for storage or network booting. This book and the corresponding GitHub repo show you how.
This book starts off with a foundation of manual builds, working our way up to build automation. Build automation can help speed up your development experience, so you may want to go back over the book in reverse using automation.
I would like to thank a few members of the Packer engineering team who have occasionally tested, provided feedback, or helped guide some of the sample code for this book, namely Megan Marsh, Wilken Rivera, and Lucas Bajolet.
Any author commissions for this title will be donated to the Raspberry Pi Foundation to encourage kids to learn how to code.