I'm newer to packer and aws...I've spent the afternoon and got an image build if I hard code an ami image name. I can't get filtering to work. I get the error about not finding anything. I did get my sample to build successfully in aws account if I hard code the name of the ami. I'm a bit lost where to turn to next. I'll continue to search the interwebs. Looking for some direction.
My complete JSON is listed below.
amazon-ebs output will be in this color.
==> amazon-ebs: Prevalidating AMI Name: packer-ES-1534285997
==> amazon-ebs: No AMI was found matching filters: {
==> amazon-ebs: Filters: [{
==> amazon-ebs: Name: "name",
==> amazon-ebs: Values: ["ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*"]
==> amazon-ebs: },{
==> amazon-ebs: Name: "root-device-type",
==> amazon-ebs: Values: ["ebs"]
==> amazon-ebs: },{
==> amazon-ebs: Name: "virtualization-type",
==> amazon-ebs: Values: ["hvm"]
==> amazon-ebs: }],
==> amazon-ebs: Owners: ["123456789"]
==> amazon-ebs: }
Build 'amazon-ebs' errored: No AMI was found matching filters: {
Filters: [{
Name: "name",
Values: ["ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*"]
},{
Name: "root-device-type",
Values: ["ebs"]
},{
Name: "virtualization-type",
Values: ["hvm"]
}],
Owners: ["123456789"]
}
complete json
{
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `access_key_#`}}",
"secret_key": "{{user `secret_key_#`}}",
"region": "us-east-1",
"instance_type" : "t2.micro",
"ssh_username" : "ubuntu",
"ami_name" : "packer-ES-{{timestamp}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": ["123456789"],
"most_recent": true
},
"launch_block_device_mappings" : [
{
"device_name" : "/dev/sdb",
"delete_on_termination" : true,
"volume_size" : 10,
"volume_type" : "gp2"
}
],
"ami_block_device_mappings" : [
{
"device_name" : "/dev/sdb",
"delete_on_termination" : true,
"volume_type" : "gp2"
}
]
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"lsblk",
"df -h"
]
}
]
}