Unable to create series 5 instance on AWS

Hi,

I am creating a new AMI using the hashicorp packer, but the instance I create have ENA error, and connection errors to the instance launched.
I am using the following configuration in my packer and using packer of version 1.5.4:
“builders”: [
{
“type”: “amazon-ebs”,

        "access_key": "{{user `aws_access_key_id`}}",
        "secret_key": "{{user `aws_secret_access_key`}}",

        "instance_type": "m5.large",
        "region": "{{user `region`}}",
        "source_ami": "{{user `source_ami`}}",
        "ssh_username": "{{user `ssh_username`}}",
        "ssh_pty" : "true",

        "ami_name": "my_name",
        "ami_description": "My AMI",

        "ena_support": true,
        "ami_virtualization_type": "hvm",
        "associate_public_ip_address": true,
        "ssh_interface": "public_ip"
    }
]

When the instance type is m4.large then the AMI is created, but when I try to launch a series 5 instance (for example: m5.large) using that AMI, then the instance that is created fails on the status check of AWS and says “Instance reachability check failed”.
On the other hand, when I try to create an AMI with instance_type m5.large, then the build of the AMI fails with error " amazon-ebs: Error launching source instance: InvalidParameterCombination: Enhanced networking with the Elastic Network Adapter (ENA) is required for the ‘m5.large’ instance type. Ensure that you are using an AMI that is enabled for ENA."

What I am doing wrong here? what should I change to make it work?

Thanks in advance,
Alexey

off the top off my head, but I think you need to have the enhanced networking drivers installed inside the AMI as well.
for what I remember Amazon Linux 2 AMIs have this prebuilt, for CentOS, etc this has to be done yourself.
btw, creating any large machine type during “creating the AMI” would be just spending more money. any reason why you need m5 during the AMI creation phase?