2.1.1 • Public • Published


A CLI to sync a local directory with an AWS S3 bucket. Example usage could involve an automated deployment of a serverless web app. This command essentially uploads a folder to a bucket.


For use within a project:

npm install @foo-software/s3-directory-sync-cli --save-dev

For global use:

npm install @foo-software/s3-directory-sync-cli -g


Command line:

s3-directory-sync \

In a project package.json (assuming environment variables like S3_DIRECTORY_SYNC_ACCESS_KEY_ID=abcdef):

  "scripts": {
    "deploy": "s3-directory-sync"


Parameters can either be passed in the command line as arguments or as environment variables.

Name Description Default
S3_DIRECTORY_SYNC_ACCESS_KEY_ID The AWS accessKeyId for an S3 bucket. --
S3_DIRECTORY_SYNC_BUCKET The AWS Bucket for an S3 bucket. --
S3_DIRECTORY_SYNC_DERIVE_CONTENT_TYPE If set to true will derive `Content-Type` metadata from file extension via mime-types false
S3_DIRECTORY_SYNC_SECRET_ACCESS_KEY The AWS secretAccessKey for an S3 bucket. --
S3_DIRECTORY_SYNC_LOCAL_DIRECTORY The local directory to sync (upload), relative to the directory of the command execution. --
S3_DIRECTORY_SYNC_PROGRESS If set to true the CLI will display a progress bar. Might be buggy in CI which justifies this option. false
S3_DIRECTORY_SYNC_REMOTE_DIRECTORY The directory of an S3 bucket to sync from a local directory. An empty string signifies the root. ''
S3_DIRECTORY_SYNC_REMOVE_HTML_EXTENSIONS If true HTML files will be uploaded with the `.html` extension omitted from the `Key`. This can be helpful if hosting an S3 website. false
S3_DIRECTORY_SYNC_REMOVE_HTML_EXTENSIONS_EXCLUDE An escape hatch to the above S3_DIRECTORY_SYNC_REMOVE_HTML_EXTENSIONS option. In the future, perhaps we could make this into a regex, but for now you can populate this value with a comma-separated list of paths relative to the local directory. Example static/html/iframe.html,static/html/iframe2.html (no glob pattern or dot prefix). ''
S3_DIRECTORY_SYNC_ACL The Access Control Policy as documented. public-read
S3_DIRECTORY_SYNC_STRICT Set to true if remote files that don't exist locally should be removed. false


This package was brought to you by Foo - a website quality monitoring tool. Automatically test and monitor website performance, SEO and accessibility with Lighthouse. Analyze historical records of Lighthouse tests with automated monitoring. Report with confidence about SEO and performance improvements to stay on top of changes when they happen!

Package Sidebar


npm i @foo-software/s3-directory-sync-cli

Weekly Downloads






Unpacked Size

16.9 kB

Total Files


Last publish


  • adamhenson