22
Packer Series - Blog #1 Creating our first AWS AMI with Hashicorp Packer
Let us first understand, what is Packer?
Packer is an open source tools used for creating identical machine images for multiple platforms for a single source configuration.
There are three major components of Packer -
*** For this blog we are just going to use the Builder element,and subsequently we will look into Provisioners and Post-Processors in the upcoming blogs in the Packer Series ***
Let's get started

Basic pre-requisites for creating an AWS AMI with Packer would be -
If you are not aware of how to create an IAM user and execute aws configure, please go through these links-
https://www.youtube.com/watch?v=5YnTstk3RxM
https://www.youtube.com/watch?v=JvtmmS9_tfU
https://www.youtube.com/watch?v=n3KacV0UlSM
https://www.youtube.com/watch?v=5YnTstk3RxM
https://www.youtube.com/watch?v=JvtmmS9_tfU
https://www.youtube.com/watch?v=n3KacV0UlSM
Next step, would be to download the Packer software from https://www.packer.io/downloads
And, we are good to proceed!
Now, we need to choose an IDE of our choice( I have used VS Code for this task), create a packer directory/folder in your system and within it code an example.json file.
example.json code - https://github.com/RajitPaul11/Packer/tree/main/Project1
The Packer component that we have used in this code is Builders which helps us to create a machine image for a single platform (in this case AWS).
Hashicorp Packer Amazon Builders Doc -
To know more about Packer Terminologies -
Once we have the code in place we need to run the packer build command in our terminal, and the command goes as follows -
packer build example.json
packer build example.json
The packer build command will
So the packer build output will look something like this

Once the build is complete, we will be able to see a terminated Packer build EC2 instance in our AWS Console with a private AMI :)

Thanks for reading, see you in the next blog!