From the course: Learning HashiCorp Packer

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Automate AWS AMI base build

Automate AWS AMI base build - Packer Tutorial

From the course: Learning HashiCorp Packer

Automate AWS AMI base build

- [Instructor] So let's automate the finding of the AMIs. This is something Packer allows us to do and it's actually very useful to ensure that you always get the latest image every time you run the build. So we'll replace the source AMI section here with source AMI filter. So that is source underscore AMI underscore filter. And that opens up into an object, so let's open curly braces. And like we did with the Marketplace, we first start by filtering the owners. So what I have here are property owners, and that can be a list. So we only want the owner ID that is for Canonical and we grab that from Canonical's official documentation which is here. So we'll just copy that again and paste that in here. So that's still gonna give us thousands of AMIs like we did before, so it's not gonna get the one that we want. So we need to add a few more filters in here. And we can add a new filters object, so if we type in filters and open curly brace, and we can open multiple ones here. We need to…

Contents