[英]packer not able to find private AMI
我在亚马逊上创建了一个私人 ami,并在上面手动安装了一些东西。 我是 packer 的新手,我现在想使用以前的图像作为基础并使用 packer 创建新的 ami。 但是我不断收到错误消息,指出我的基本图像不存在。 这是我的打包文件
data "amazon-ami" "cocktails" {
filters = {
virtualization-type = "hvm"
name = "test-ami-24112022"
root-device-type = "ebs"
}
owners = ["my-account-id"]
most_recent = true
}
source "amazon-ebs" "cocktails" {
instance_type = "t2.micro"
region = "eu-west-2"
ssh_username = "ec2-user"
ami_name = "test-${uuidv4()}"
source_ami = data.amazon-ami.cocktails.id
}
build {
sources = ["source.amazon-ebs.cocktails"]
provisioner "file" {
source = "test.txt"
destination = "/home/ec2-user/test.txt"
}
}
这是我得到的错误
Datasource.Execute failed: No AMI was found matching filters: {
Filters: [{
Name: "root-device-type",
Values: ["ebs"]
},{
Name: "virtualization-type",
Values: ["hvm"]
},{
Name: "name",
Values: ["test-ami-24112022"]
}],
Owners: ["my-account-id"]
}
on main.pkr.hcl line 1:
(source code not available)
问题出在我的 aws 配置文件中。 它有一些我以前使用过的预加载数据,它指向错误的区域,当我删除配置并使用正确的区域重新创建时它起作用了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.