Ansible dynamic inventory using AWS plugin -- how to obtain internal DNS records or private IP?
The hostnames parameter controls what the plugin uses as the host name. It accepts a list of attributes, and will use the first one that the instance has defined:
hostnames:
  - private-dns-name
  - private-ip-address

You can also set the ansible_host variable using compose. This changes the connection target without modifying the inventory hostname:
compose:
  # Note the underscores; this functionality uses the Ansible variable names instead of the raw AWS attributes.
  ansible_host: private_ip_address