我正在尝试使用packer来创建一个新的AMI。我想使用的基础图像为"ami-03ededff12e34e59e"(Amazon Linux 2)
我使用以下过滤器:
data "amazon-ami" "amzn2" {
owners = ["099720109477"]
most_recent=true
region = "us-east-1"
filters = {
virtualization-type = "hvm"
architecture = "x86_64"
root-device-type = "ebs"
owner-alias = "amazon"
name = "amzn2-ami-hvm-*"
}
}
但是,我得到以下错误:
Error: Datasource.Execute failed: No AMI was found matching filters: {
你知道我在哪里犯了错吗?
我认为问题是owner
属性。对于Amazon Linux 2,它应该是amazon
。
data "aws_ami" "amazon_linux" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["amzn2-ami-hvm-*-x86_64-gp2"]
}
}