# Copy file from S3 to Remote Host

**URL:** <https://forum.ansible.com/t/copy-file-from-s3-to-remote-host/27409>\
**Category:** Ansible Project\
**Created:** [April 30, 2018, 7:54am UTC](https://forum.ansible.com/t/copy-file-from-s3-to-remote-host/27409 "2018-04-30T07:54:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ali.khawaja](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@ali.khawaja](https://forum.ansible.com/u/ali.khawaja)\
**Post date:** [April 30, 2018, 7:54am UTC](https://forum.ansible.com/t/copy-file-from-s3-to-remote-host/27409/1 "2018-04-30T07:54:50Z")

</div>

Hi Everyone,

I want to copy a file from S3 to an EC2 host. How can I achieve that? Aws\_s3 module has destination but I am not sure how can I use that to provide a remote server location?

---

<div class="post-metadata">

**Author:** ![Arbab\_Nazar1](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Arbab\_Nazar1](https://forum.ansible.com/u/Arbab_Nazar1)\
**Post date:** [April 30, 2018, 8:01pm UTC](https://forum.ansible.com/t/copy-file-from-s3-to-remote-host/27409/2 "2018-04-30T20:01:09Z")

</div>

Here is working example:

- name: Download the latest version of app from S3 bucket  
aws\_s3:  
aws\_access\_key: “{{ AWS\_S3\_ACCESS\_KEY }}” # take from env or using profile  
aws\_secret\_key: “{{ AWS\_S3\_SECRET\_KEY }}”  
bucket: BUCKET-FULL-NAME  
object: “/directory-inside-bucket/file-that-you-want-to-download”  
mode: get  
dest: “/tmp/file-name” #will download and store in /tmp with your provided filename

Don’t forget to install boto3 on remote host otherwise it will fail. Le me know if you need any help
