Skip to content

Commit 91c0ef1

Browse files
authored
Create template.pkr.hcl
1 parent 78fc607 commit 91c0ef1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

template.pkr.hcl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
packer {
2+
required_plugins {
3+
amazon = {
4+
version = ">= 1.0.0"
5+
source = "github.com/hashicorp/amazon"
6+
}
7+
}
8+
}
9+
10+
source "amazon-ebs" "my_vm" {
11+
region = "us-east-1"
12+
source_ami = "ami-04b4f1a9cf54c11d0"
13+
instance_type = "t3.micro"
14+
ssh_username = "ubuntu"
15+
ami_name = "my-vm-image-${formatdate("YYYYMMDD-hhmmss", timestamp())}"
16+
17+
#temporary_key_pair_type = "ed25519"
18+
}
19+
20+
build {
21+
sources = [
22+
"source.amazon-ebs.my_vm"
23+
]
24+
25+
provisioner "file" {
26+
source = "main.py"
27+
destination = "/tmp/main.py"
28+
}
29+
30+
provisioner "shell" {
31+
inline = [
32+
"sudo apt-get update",
33+
"sudo apt-get install -y python3-pip",
34+
"python3 /tmp/main.py"
35+
]
36+
}
37+
}

0 commit comments

Comments
 (0)