Packer lets us create machine images for a variety of platforms through code. A Packer template requires at least a builder and a communicator to provision an image. In this lab, we’ll create an AWS machine image using the `amazon-ebs` builder and `ssh` communicator.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Locate a Usable Source Image
- Log in to the AWS Management Console, and navigate to EC2 > AMIs.
- Filter by Owner: Amazon images and Platform: Amazon Linux. You may additionally search for platform type (
hvm
), or perform any additional filtering you deem necessary. - Look at the Source cell, and note how the source name is written.
- Create the Packer Template
- Create a directory to store your templates.
- Create the Packer file.
- Begin the template, creating a
variables
object with variables for the access key, secret key, subnet ID, and security group.
- Test the Template
- Update the variables in the template based on the information provided by the hands-on lab, and then save and exit the JSON file.
- Validate the template.
- Run the build.