This is not the only solution - valid offers have been made, but what I almost always do when using the EC2 inventory plugin uses the Ansible function, which I think many people donβt know about: you can use the catalog as an inventory.
Ansible looks for executables and flat files in a directory and combines their results. This is very useful because you can use a flat file to create nice aliases for dynamic groups and add a local host there, possibly setting some variables for it.
$ tree inventory/staging inventory/staging βββ base βββ ec2.ini βββ ec2.py βββ group_vars -> ../group_vars
An excerpt from the base file is as follows:
[localhost]
Then you just point to the directory for the inventory:
$ ansible -i inventory/staging webservers -m ec2_facts
source share