To run a playbook against an AWS dynamic inventory, you can define following environment variables:
export AWS_ACCESS_KEY_ID='AK123'
export AWS_SECRET_ACCESS_KEY='abc123'
Then clone this repo, and execute the command inside it:
ansible-playbook -i inventory [option] playbook.yml
You can edit the ec2.ini, which defined the regions to check, what dns names or ip addresses to be used, rules to group ec2 nodes, and so on.