Ansible has one module named ec2. This is a module that is used to connect AWS from Ansible-Playbook. I have attached one playbook below for your reference.
- hosts: localhost
- name: AWS OS provisioning