簡體   English   中英

打包程序無法找到私有 AMI

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM