A Packer template is a declarative configuration that tells Packer how to create a machine image. For an AWS AMI, it defines Packer plugins, the source AMI, the temporary EC2 instance, its connection method, and the build actions. section 15.3
An AWS Packer template commonly contains:
- A Systems Manager connection instead of direct SSH access, using the required ec2-ssm-core IAM instance profile. section 15.3
Build an Etherpad AMI
Install Packer, initialize the template, and build the image with: brew install hashicorp/tap/packer; packer init chapter15/; packer build chapter15/etherpad.pkr.hcl. Packer launches an EC2 instance, runs commands that install Node.js, Git, and Etherpad, stops the instance, creates an AMI, and terminates the instance. The resulting AMI ID can be passed to CloudFormation for deployment through a launch template and Auto Scaling group. section 15.3
