EC2 and IPv4/IPv6 auto assignment

Hello community,

I ran into an issue that I can’t figure out by myself.

We create EC2 instances using a fairly simple and straightforward ansible playbook.

We also configured (manually) a custom AWS VPC (as well as corresponding subnets) that enables IPv6 auto address assignment and disables public IPv4 auto assignment to instances that are created.

We did the same steps as mentioned here: https://www.edge-cloud.net/2016/12/12/ipv6-aws-ec2/ with the only difference that we also disabled public IPv4 auto assignment.

When I manually create an instance, all auto assignment options (public IPv4 disabled/IPv6 enabled) are used correctly and everything works like it should.

When we create an instance via ansible we may override the default public IPv4 auto assignment option depending on the usecase (which seems to work) with “assign_public_ip” set to true or false.

So I would expect that a machine that is created via ansible get a public IPv4 address depending on the status of assign_public_ip option in the playbook.

But in every case the instance should get an IPv6 address assigned. But that is not happening and I don’t get why.

I also could not find an option like assign_public_ipv6 or something similar.

Can someone please explain to me why our ansible created instances do not get an IPv6 address assigned automatically?

Best regards
René