Dear Packer group,

I am using latest packer 1.5.4

I want to get the latest AMI ID's for Ubuntu 16.04, 18.04, CentOS7,
AmazonLinux2

Packer always uses the AMI ID which is one ami behind the latest ami, even
though i tell to use the latest AMI.

The following is the aws ec2 command which will return the latest AMI.

aws ec2 describe-images \

     --filters
"Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"
\

     --query 'Images[*].[ImageId,CreationDate]' --output text \

     | sort -k2 -r \

     | head -n1


Which returns *ami-092d0fe375260a228 ,* it is the latest one.

In the packer json template i am using the following.

"source_ami": "{{user `source_ami`}}",
"source_ami_filter": {
               "filters": {
                "virtualization-type": "hvm",

"name":"ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*",
                "root-device-type": "ebs"
              },
              "owners": ["099720109477"],
              "most_recent": true
           }

it returns *ami-08bc77a2c7eb2b1da* and is not the latest one.

In the above code i am passing the latest ami id in the source_ami
variable, its not considering that, instead it picks an ami id which is one
ami behind the latest one.

Could you please let me know how can i solve this issue ?

Appreciate your reply.

Thanks & Regards
Majid M A

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CAGr0K9dkPcsy1cJaaGxNke2%3D03CPy-p%3DY8NV8wVsu9-GZkZT4A%40mail.gmail.com.

Reply via email to