Packer lets you create identical machine images for multiple platforms from a single source configuration.
Packer can create golden images to use in image pipelines.
https://developer.hashicorp.com/packer/tutorials/aws-get-started/aws-get-started-build-image
Install
choco install packer
Write Packer template
Create a fileĀ aws-ubuntu.pkr.hcl
packer {
required_plugins {
amazon = {
version = ">= 0.0.2"
source = "github.com/hashicorp/amazon"
}
}
}
source "amazon-ebs" "ubuntu" {
ami_name = "learn-packer-linux-aws"
instance_type = "t2.micro"
region = "us-west-2"
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"]
}
ssh_username = "ubuntu"
}
build {
name = "learn-packer"
sources = [
"source.amazon-ebs.ubuntu"
]
}