Hey @Roshan, ansible provides wiht AWS module which lets you write playbooks for accessing aws resources. Try the following task:
---
- hosts: localhost
become: true
tasks:
- name: Download file from S3 bucket
s3: aws_access_key=<AccessKey> aws_secret_key=<Secret Key> bucket=example object=/niru.txt dest=/home/ansible/example.txt mode=get