Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

sbt-s3

sbt-s3 is a simple sbt plugin to manipulate objects on Amazon S3

Subscribe to updates I use sbt-s3


Statistics on sbt-s3

Number of watchers on Github 41
Number of open issues 2
Average time to close an issue 4 months
Main language Scala
Average time to merge a PR 7 days
Open pull requests 4+
Closed pull requests 4+
Last commit almost 2 years ago
Repo Created almost 7 years ago
Repo Last Updated almost 2 years ago
Size 68 KB
Organization / Authorsbt
Contributors9
Page Updated
Do you use sbt-s3? Leave a review!
View open issues (2)
View sbt-s3 activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating sbt-s3 for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

sbt-s3

Description

sbt-s3 is a simple sbt plugin that can manipulate objects on Amazon S3.

Usage

  • add to your project/plugin.sbt: resolvers += Resolver.url("sbts3 ivy resolver", url("http://dl.bintray.com/emersonloureiro/sbt-plugins"))(Resolver.ivyStylePatterns) addSbtPlugin("cf.janga" % "sbts3" % "0.10.2")
  • then add to your build.sbt the line: enablePlugins(S3Plugin)

You will then be able to use the tasks s3-upload, s3-download, s3-delete, and s3-generate-links, defined in the object com.typesafe.sbt.S3Keys as s3Upload, s3Download, s3Delete, and s3GenerateLinks respectively. All these operations will use HTTPS as a transport protocol.

Please check the Scaladoc API of the S3Plugin object, and the S3Keys object, to get additional documentation on the available sbt tasks, and their parameters.

Example 1

Here is a complete example:

project/plugin.sbt:

resolvers += Resolver.url("sbts3 ivy resolver", url("http://dl.bintray.com/emersonloureiro/sbt-plugins"))(Resolver.ivyStylePatterns)

addSbtPlugin("cf.janga" % "sbts3" % "0.10.2")

build.sbt:

enablePlugins(S3Plugin)

mappings in s3Upload := Seq((new java.io.File("a"),"zipa.txt"),(new java.io.File("b"),"pongo/zipb.jar"))

s3Host in s3Upload := "s3sbt-test.s3.amazonaws.com"

credentials += Credentials(Path.userHome / ".s3credentials")

~/.s3credentials:

realm=Amazon S3
host=s3sbt-test.s3.amazonaws.com
user=<Access Key ID>
password=<Secret Access Key>

Just create two sample files called a and b in the same directory that contains build.sbt, then try:

$ sbt s3-upload

You can also see progress while uploading:

$ sbt
> set s3Progress in s3Upload := true
> s3-upload
[==================================================]   100%   zipa.txt
[=====================================>            ]    74%   zipb.jar

Unless explicitly provided as described above, credentials will be obtained via (in order):

  1. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables
  2. aws.accessKeyId and aws.secretKey Java system properties
  3. Default aws cli credentials file (~/.aws/credentials)
  4. IAM instance profile if running under EC2.

Example 2

As well as simply uploading a file to s3 you can also set some s3 ObjectMetadata. For example, you may want to gzip a CSS file for quicker download but still have its content type as css, In which case you need to set the Content-Type and Content-Encoding, a small change to build.sbt is all that is needed.

build.sbt:

enablePlugins(S3Plugin)

mappings in s3Upload := Seq((target.value / "web" / "stage" / "css" / "style-group2.css.gz" ,"css/style-group2.css"))

def md = {
  import com.amazonaws.services.s3.model.ObjectMetadata
  var omd = new ObjectMetadata()
  omd.setContentEncoding("gzip")
  omd.setContentType("text/css")
  omd
}

s3Metadata in s3Upload := Map("css/style-group2.css" -> md)

s3Host in s3Upload := "s3sbt-test.s3.amazonaws.com"

credentials += Credentials(Path.userHome / ".s3credentials")

License

This code is open source software licensed under the Apache 2.0 License.

sbt-s3 open pull requests (View All Pulls)
  • Generate S3 Links
  • Handling host containing region
  • Add proxy capability to use with s3 client.
  • Adding proxy support to the S3 client
sbt-s3 list of languages used
Other projects in Scala