GithubHelp home page GithubHelp logo

s3filesync's Introduction

s3FileSync

The use case for this little tool was where I had thousands (5k +) files to upload to s3. Rather than having to sit and upload them in batches I wanted to use something that I knew would work and would only upload files that had not already been uploaded.

Other s3sync commands/utils were just not doing it for me.

Config

Set some AWS access key's in your local shell environment.

You're advised to use IAM users and allow the following actions, s3:GetObject, s3:GetObjectAcl, s3:ListBucket, s3:PutObject, and s3:PutObjectAcl. Note also that with the s3:ListBucket action you may have to specify the bucket and all things under the bucket as resources.

If you need it grunt-aws-s3 contains a whole lota extra detail on the config options used.

Installation

You will need Node.js and NPM (which is bundled with Node.js), and then just need to run the following command.

npm install

Running

There is a script which

  • symlinks whichever directory you want to upload to an uploads directory in the project root.
  • sets appropriate ENV vars
  • launches grunt which then uses aws_s3 to sync the files.
cd ${installationDir}
./s3FileSync <path-to-files> <bucket-name> <prefix>

Where:

  • <path-to-files> -- The path to the files that you want to upload
  • <bucket-name> -- The bucket to upload to.
  • <prefix> -- The 'folder' in the bucket to put the files in. (not strictly a folder but will be prepended to the file's key when uploaded and will act as if it were a folder. in most situations)

You may need to update Gruntfile.js with your specific region and desired concurrency. I may make that configurable in a future iteration.

Limitations

If you have very large amounts of files (over 8000) in a single directory the upload will work well, but subsequent sync's may struggle.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.