If you’re using Ansible with the AWS EC2 plugin ec2_eni and getting this error:
AttributeError: 'NetworkInterface' object has no attribute 'attach'
The problem is that the boto NetworkInterface object indeed does not have anything called “attach” — you’re probably using an old version of boto; “attach” was added somewhere between 2.20 and 2.38. So, upgrading your boto version should fix it.
First, check that you don’t have boto installed via your package manager; I opened Ubuntu’s Software Sources and searched for boto, sure enough had to uninstall it.
Then, install the latest version with “sudo pip install boto”. Should work now!