Using Packer to Create an AWS AMI

Get Started
30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

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
  1. Log in to the AWS Management Console, and navigate to EC2 > AMIs.
  2. 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.
  3. Look at the Source cell, and note how the source name is written.
Create the Packer Template
  1. Create a directory to store your templates.
  2. Create the Packer file.
  3. Begin the template, creating a variables object with variables for the access key, secret key, subnet ID, and security group.
Test the Template
  1. Update the variables in the template based on the information provided by the hands-on lab, and then save and exit the JSON file.
  2. Validate the template.
  3. Run the build.

Additional Resources

You are the newest DevOps engineer on Pax Computopia's DevOps team, and you need to prepare a new Amazon Linux 2 image to work as the golden image for database servers. Since Packer is new to you and no existing Amazon Linux examples exist in your team's repositories, you want to work in steps — and the first step is making sure you have a working base image.

Create a Packer template that bases the image on the most recent Amazon Linux 2 AMI. Be sure the image is owned by Amazon, uses HVM virtualization, and test on a t2.micro server.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?