Packer
HashiCorp Packer image building. Use for machine images.From its SKILL.md
npx -y skills add G1Joshi/Agent-Skills --skill packerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 12 stars12 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.0 KB, 500 tokens by cl100k_base, as published. Nobody here has run it
Packer
Packer automates the creation of Machine Images (AMI, VMDK, ISO) for multiple platforms from a single configuration. In 2025, HCL2 is the standard for configuration.
When to Use
- Immutable Infrastructure: Bake your app code into the OS image. Booting a pre-baked AMI is faster than running Ansible on boot.
- Golden Images: Create hardened, secure base images for your organization.
- Multi-Cloud: Build an AMI for AWS and a VHD for Azure from the same script.
Quick Start (HCL2)
source "amazon-ebs" "ubuntu" {
ami_name = "my-app-{{timestamp}}"
instance_type = "t3.micro"
region = "us-west-2"
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"] # Canonical
}
ssh_username = "ubuntu"
}
build {
sources = ["source.amazon-ebs.ubuntu"]
provisioner "shell" {
inline = ["sudo apt-get update", "sudo apt-get install -y nginx"]
}
}
Core Concepts
Builders
Cloud-specific components (e.g., amazon-ebs, azure-arm) that launch a VM.
Provisioners
Tools to configure the VM (Shell, Ansible, Chef) before it is turned into an image.
Post-Processors
What to do with the image (Upload to S3, Vagrant Box, Docker Push).
Best Practices (2025)
Do:
- Use HCL2: JSON templates are legacy. HCL2 supports variables and logic.
- CI Integration: Run Packer in CI pipeline to produce new AMIs on every release.
- Cleanup: Ensure Packer cleans up temporary resources (Security Groups, Key Pairs) after build.
Don't:
- Don't bake secrets: Never put passwords in the image. Use Cloud-init or User Data to inject them at runtime.
References
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.