HashiCorp Packer
February 2, 2025 ยท View on GitHub
Packer is a tool for automating building virtual machines templates such as importable .ova files.
This usually involves running automated installers that are native to each Linux distribution such as:
- Debian Preseed
- Redhat Kickstart
- Ubuntu Autoinstall
Packer can be used to create AMI + Vagrant box at same time.
- Configs
- Convert an Old Packer JSON template to HCL
- Sharing AMIs Between AWS Accounts
- Troubleshooting
Configs
See HariSekhon/Packer repo.
Convert an Old Packer JSON template to HCL
packer hcl2_upgrade "$file.json"
Output:
Successfully created "$file.json.pkr.hcl". Exit 0
Sharing AMIs Between AWS Accounts
Packer can build in your CI/CD AWS account, and then you can share to your other AWS Accounts from this central place.
See AWS - Sharing AMIs Between Accounts.
Troubleshooting
Debug Mode
PACKER_LOG=1 packer build "$file.pkr.hcl"