From 22047cacd7c01f50985c87780b76dde80689c1c7 Mon Sep 17 00:00:00 2001 From: gregory hendrickson Date: Tue, 21 Nov 2023 14:26:26 -0800 Subject: [PATCH] simple ubuntu packer image build ``` --- ubuntu.pkr.hcl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ubuntu.pkr.hcl diff --git a/ubuntu.pkr.hcl b/ubuntu.pkr.hcl new file mode 100644 index 0000000..af67c23 --- /dev/null +++ b/ubuntu.pkr.hcl @@ -0,0 +1,29 @@ +packer { + required_version = ">= 0.0.2" + } + + source "amazon-ebs" "ubuntu" { + ami_name = "test-custom-ubuntu20.04-ami" + instance_type = "t2.micro" + region = "us-west-1" + ssh_username = "ubuntu" + # 22.04 "ami-0cbd40f694b804622" # 20.04 "ami-0da7657fe73215c0c" + source_ami = "ami-0da7657fe73215c0c" + temporary_key_pair_name = "packer_ubuntu" + temporary_key_pair_type = "ed25519" +} + +build { + name = "ubuntu-ami" + sources = ["source.amazon-ebs.ubuntu"] + + provisioner "shell" { + inline = [ + "sleep 30", + "sudo apt-get update", + "sudo apt-get install -y nginx", + "sudo service nginx start" + ] + } + +} \ No newline at end of file