-
-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathami-automl.pkr.hcl
51 lines (43 loc) · 1.63 KB
/
ami-automl.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
variable "source_ami" {
type = string
description = "Ubuntu Server 18.04 LTS (HVM), EBS General Purpose (SSD) VolumeType"
default = "ami-0bdf93799014acdc4"
# Optional: define a filter to automatically pick the latest version of an ami as source ami.
// 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"]
// }
}
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
# source blocks configure your builder plugins; your source is then used inside
# build blocks to create resources. A build block runs provisioners and
# post-processors on an instance created by the source.
source "amazon-ebs" "automl-ami" {
# the profile to use in the shared credentials file for AWS.
// profile = "default"
ami_name = "ami-automl-${local.timestamp}"
ami_description = "AMI for the AutoML benchmark project"
# uncomment following line to create a public ami, default a private ami is created
// ami_groups = ["all"]
instance_type = "t2.micro"
source_ami = var.source_ami
ssh_username = "ubuntu"
}
# a build block invokes sources and runs provisioning steps on them.
build {
sources = ["source.amazon-ebs.automl-ami"]
provisioner "shell" {
execute_command = "echo 'packer' | sudo -S env {{ .Vars }} {{ .Path }}"
environment_vars = [
"BRANCH=stable",
"GITREPO=https://github.com/openml/automlbenchmark",
"PYV=3"
]
script = "./scripts/configure-ami.sh"
}
}