NodeJS bash utility for deploying files to Amazon S3
s3-deploy './dist/**' --cwd './dist/' --region AWS_REGION --bucket SOME_BUCKET_NAME --distId CF_DIST_ID --invalidate '/INV_PATH_1 /INV_PATH_2'
Deploys files found by the
./dist/** glob patten to S3. Change
AWS_REGION with the AWS region of your bucket and
SOME_BUCKET_NAME with the name of your bucket where files should end up. It's a common scenario to invalidate files in CloudFront distribution, just pass distribution ID to
--distId to invalidate everything.
--gzip will gzip all files before sending them to S3, and adds appropriate
Content-Encoding: gzip metadata attribute on uploaded elements in S3, so that when they are opened in the browser, the browser knows to decompress them first before displaying. You can specify the list of file extensions to gzip, e.g.
Use this parameter to specify the
Cache-Control: max-age=X header, where X is the number of seconds a given item will be kept in the cache for. By default this value is undefined.
Use this parameter to validate that the object either currently does not exist in the bucket, or
that it already matches the ETag hash and thus is skipped and not uploaded. This effectively ensures that S3 Objects will not be modified. This is useful with the
When a page is refreshed, which is an extremely common social media scenario, elements that were previously marked immutable with an HTTP response header do not have to be revalidated with the server. It sets the
Cache-Control: immutable header - using-immutable-caching-to-speed-up-the-web This is useful with the
You can also specify the
ETag: X header, where X is either user-defined value for this header, or MD5 of the content. To automatically fill this header with MD5 hash of the file, just use
--etag parameter without any value. Internally the tool will generate MD5 hash of the content and will set it as the ETag header value. By default this parameter is undefined.
You can also specify the
signatureVersion that should be used by S3 client. Current allowed values are the same as in the constructor of the S3 JS SDK Client. In the time of writing those docs those values were
Use this parameter to specify a file prefix for all your destination files. For example, if you wanted to deploy a versioned history of your project to S3 whenever publishing to npm, you could use
--filePrefix $npm_package_version in a script in your project's package.json file.
You can specify a specific AWS profile to use to connect to S3 (defaults to
default). More information on how to setup AWS profiles is available in the AWS docs.
Use this parameter to specify that objects being uploaded will be stored with private ACL (Owner gets FULL_CONTROL. No one else has access rights). By default, 'public-read' ACL is set. More information on the canned-acl is available in the AWS docs
Enables to set the correct content type header when files has no extension. For example, when the s3 bucket is used for webhosting and there is need to access paths like
/about instead of
/about.html so its possible to upload file named
about and set
Removes files in S3, that are not available in the local copy of the directory. Useful to cleanup files that should no longer reside in the remote version. Now it also has the abilityto specify glob pattern that defines filter for files that should be considered to be deleted.
If a filename in a subdirectory matches the index file, then upload two additional copies of the file: one with the same name as the directory, and one with the name of the directory followed by "/". This can be used to fake "index.html" on S3 and CloudFront, which normally has no concept of default index files.
CloudFront Distribution ID. Use along with
--invalidate to invalides files within given distribution. In case
--invalidate isn't provided everything is invalidated.
Paths to invalidate within CloudFront distribution. Value must be wrapped with quotes and each file separated by whitespace character.
--distId argument is mandatory. Defaults to
['/']. More details here:
AWS credentials can be provided via environment variables, or in the
~/.aws/credentials file. More details here:
http://docs.aws.amazon.com/cli/latest/topic/config-vars.html. Please make sure to define a default in your AWS credentials, this will help prevent a
Missing Credentials error during deployment.
npm run release
Runs eslint validation, runs all unit tests.
Run all tests
Invokes all unit tests in the project.
Generage coverage report
npm run coverage
Generates unit test coverage report.
npm run lint
Invokes eslint validation based on rules defined in the
- Commit changes to the repository on a separate branch,
- Bump version in package.json file, after you are done with your changes (remember about SemVer!),
- After you are done with your functionality, or if you think it is large enough, create a pull request with master branch to be peer reviewed,
- After changes are merged into master branch, checkout master branch, run tests one more time, and publish this package to npm repository.
Adding ability to specify glob pattern to
removeDeleted that defines filter for files that should be considered to be deleted.
- Bug fix for
Build process cleanup & vinerability fixes
- Updated build process to use
- Updated dependencies to fix vunerability issues.
Delete S3 objects recursively
- Support delete objects recursively for option
- Reason: S3 listObjects only limit
MaxKeys: 1000, so in case your deploy contains many files (much more than 1000), it may cause unexpected result (usually, it cannot delete all the necessary files)
- This fork make sure all files in S3 will be
--deleteRemovedif they are not matched with local files.
- Pass file extensions to
--gzipto zip only the given list. E.g.
The v0.11 re-published to follow stricter SemVer.
- Added a new feature to invalidate paths in CloudFront using
--distId(distribution id) and
--invalidate(paths to invalidate).
- Addition of the
- Addition of the
- Fix for windows setup.
- Adding he ability to cleanup old files in the remote location during the deployment
- Adding the ability to set the extension if the files without one or there is need to override it
- Reverting changes to readFile function from PR https://github.com/import-io/s3-deploy/pull/11 as unfortunately it caused other issues: https://github.com/import-io/s3-deploy/issues/14
- Adding the ability to set private ACL for object
- Fixing incorrect folder structure when
s3-deployis used from windows machine.
- Adding the ability to specify
- Fixing the
aws-sdkpackage version to
2.3.19, because of: https://github.com/aws/aws-sdk-js/issues/1035
- Adding the ability to specify
signatureVersionin S3 client,
- Fixing the tool to work correctly when no
--etagargument is used.
- Adding ability to provide ETag header value.
- Fixing an issue with cache parameter.
- Adding ability to specify Cache-Control max-age seconds.
babelto be a dev-dependency.
- Adding new command line parameter
--gzip. When this is added, all files will be gzipped before sending them to Amazon S3.
- Updating the repository URL.
- Adding ability to publish package from CircleCI.
- Adding a missing
cryptoimport in the utils.
- Publishing the package publicly.
- Switching to a node script in .bin directory, as bash script doesn't work when it is used through the symlink.
- Going back to babel pre-compilation, and adding an .sh script to run the command later on,
- Adding babel/polyfill to the package as we are using generators inside the command.
- Fixed a bug which made teh package not run at all.
- Initial version of the project,
- Ability to deploy files in the given glob pattern to provided S3 bucket, on provided S3 region.