Installation of Packer

Please visit my website and subscribe to my youtube channel for more articles

In this blog, we will do the Installation of Packer

Please follow the below steps


Image for post
Image for post

Packer is successfully installed on your system.

Packer Components

Packer calls the process of creating an image a build.

Artifacts are the output from builds. One of the more useful aspects of Packer is that you can run multiple builds to produce multiple artifacts.

A build is fed from a template. The template is a JSON document that describes the image we want to build — both where we want to build it and what the build needs to contain.

To determine what sort of image to build, Packer uses components called builders. A builder produces an image of a specific format — for example, an AMI builder or a Docker image builder. Packer ships with a number of builders and you can also add your own builder in the form of plugins.

Running Packer

Image for post
Image for post

Create a Json file to create an image

"variables": {
"aws_access_key": "",
"aws_secret_key": ""
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami": "ami-a025aeb6",
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "packer-example {{timestamp | clean_ami_name}}"

2. Run the below command to validate the packer

$ packer validate ami.json
Template validated successfully.

3. Build the image

$  packer build ami.json
Image for post
Image for post
Image for post
Image for post

You’ve now created your first Packer image successfully.

Devops Automation Enginneer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store