Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to automatically upload files to S3 from my server

Tags:

amazon-s3

I have a project to complete and I am stuck at a point. Could we upload files from our server into S3 automatically at a certain time interval?

For example: A part of the data should be uploaded and from then, for every one hour, the next set of data should get uploaded.

like image 364
prudhvi Avatar asked Sep 19 '16 17:09

prudhvi


1 Answers

Follow this steps;

  1. Create a script file for example name it script.sh.
  2. Add this to the script.sh file and save the file

    #!/bin/bash
    aws s3 cp /local-folder-path/  s3://bucket-name`
    
  3. Install AWS CLI

  4. Create a IAM user that has access to that S3 bucket and add his AWS Key and Key secret to AWS Configure Link

  5. Set up a cron job for 1 hour. And you are done those files will be copied to S3 bucket each hour.

    0 */1 * * * /path-to-script-file/script.sh`
    
like image 67
error2007s Avatar answered Dec 31 '22 18:12

error2007s