Starting with the latest Debian 12 ami (ami-04d8e65bd49d048bd), sudo: unable to resolve host ip-x-x-x-x: Name or service not known

This ticket is about the latest Debian 12 ami for AWS.

With

aws ssm get-parameters-by-path --path /aws/service/debian/release/bookworm/ --recursive

I was able to list all official Debian 12 AMIs and I am only interested in amd64 AMIs.

My VPC and subnet have enableDnsSupport set to true.

All my tests are made in the same VPC, same subnet and same security group. The only thing that changes is the AMIs (all of them from the official Debian account). I don't do any config in the EC2 instances. I just start then and try to run a sudo command (ex: sudo ls)

With the following AMIs : ami-087da76081e7685da, ami-058a645884552df66 and ami-07254a4b88b1dc88d I can sudo without any issues

$ sudo ls => my current folder is empty
$ hostname -f
ip-10-0-3-203

if I run a sudo apt update && sudo apt full-upgrade -y, everything looks great and I have the same result with sudo ls and hostname -f

With the latest AMI (ami-04d8e65bd49d048bd) when I run any sudo command (ex : sudo ls) I am getting the following error

$ sudo ls
sudo: unable to resolve host ip-10-0-3-101: Name or service not known
$ hostname -f
hostname: Name or service not known

cat /etc/hosts on all ami have the same pattern

127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

Same for cat /etc/hostname

ip-10-0-3-203

How could I fix the issues on instances using the latest Debian 12 ami (ami-04d8e65bd49d048bd) ?

PS: I have also open a SO ticket and if someone can help me figuring out what's the issue is, I would be happy to report the solution to the SO ticket also (https://stackoverflow.com/questions/78399734/starting-with-the-latest-debian-12-ami-ami-04d8e65bd49d048bd-sudo-unable-to)

Edited by Yanal-Yves FARGIALLA