liveBook · Manning

Packer template

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

A Packer template is a declarative configuration that specifies how Packer should create a machine image.

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

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Defines plugins, sources, connections, provisioning, and commands, but defers broader image-management details.
Examples
Uses an Etherpad template, Amazon Linux source filtering, shell provisioning, and a generated AMI ID.
What it assumes
Assumes an IAM role for Systems Manager and teaches the workflow from manual setup through scripted provisioning.
What you can do after
Build it from scratch, test the resulting AMI, and roll it out through CloudFormation.
How it connects
Connects AMIs with EC2, Systems Manager, IAM roles, CloudFormation, launch templates, and Auto Scaling groups.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.