简体   繁体   English

打包程序无法找到私有 AMI

[英]packer not able to find private AMI

i create a private ami on amazon and installed few things on it manually.我在亚马逊上创建了一个私人 ami,并在上面手动安装了一些东西。 I am new to packer and i now want to use the previous image as base and create new ami using packer.我是 packer 的新手,我现在想使用以前的图像作为基础并使用 packer 创建新的 ami。 However i keep on getting error message that my base image does not exists.但是我不断收到错误消息,指出我的基本图像不存在。 Here is my packer file这是我的打包文件

       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"
 }
}

This is the error i am getting这是我得到的错误

   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)

The issue was in my config file of aws.问题出在我的 aws 配置文件中。 It had some pre loaded data which i used previously and it was pointing to wrong region, when i deleted the config and recreated using correct region it worked它有一些我以前使用过的预加载数据,它指向错误的区域,当我删除配置并使用正确的区域重新创建时它起作用了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM