packer { required_plugins { amazon = { version = ">= 1.2.8" source = "github.com/hashicorp/amazon" } } } source "amazon-ebs" "al2023" { ami_name = "learn-packer-linux-aws" instance_type = "t3.micro" region = "ap-east-1" vpc_id = "vpc-01a10b033169f89a8" subnet_filter { filters = { "tag:Name" = "*shared*" } most_free = true random = false } encrypt_boot = true source_ami_filter { filters = { name = "al2023-ami-2023*-kernel-6.1-x86_64" root-device-type = "ebs" virtualization-type = "hvm" } most_recent = true owners = ["910595266909"] } ssh_username = "ec2-user" } build { name = "learn-packer" sources = [ "source.amazon-ebs.al2023" ] }