Using Packer to Create vSphere and AWS Images

Using Packer to Create vSphere and AWS Images

March 6, 2017 2 By Eric Shanks

Packer is a free tool from Hashicorp that allows you to build new images. Keeping base vSphere templates up to date is not too difficult of a task for many, but as we add things like AWS accounts and regions, it’s pretty easy to have sprawl to deal with. We’d like to make sure that an image in our vSphere datacenter looks the same as an image in our public clouds.

Packer gives us a great way to do this. The tool takes a JSON file and builds a new image based on the information contained within. This allows us to move our template patching and updating processes as a piece of code that can be stored in a version control repository like git. Now our builds are deployed in a repeatable fashion and we know that each month when our images are updated, that they’ll be consistent and the same across our organization. It’s pretty awesome to be able to use a file like the one below to build all of your images across your infrastructure.


AWS images update pretty straight forward by cloning an existing Amazon Machine Image (AMI), updating it and creating a new AMI from a new machine. The vSphere process can be a bit different. For example, A VMware Workstation VM can be cloned, updated and then exported to vSphere through the OVFtool. This process is slightly different but achieves the same effect. The diagram below demonstrates how the processes look.


The video below should give you a pretty good idea about how to implement this in your own environment. Good luck, and happy coding.