How to publish to Amazon S3 with sbt

Oscar Picasso picture Oscar Picasso · Mar 31, 2012 · Viewed 7.1k times · Source

As explained here, one can deploy to Amazon S3 with maven.

How can we do the same with sbt, that is, to publish to S3 with sbt?

Answer

tpunder picture tpunder · May 9, 2014

Here is an SBT Plugin I wrote for publishing to Amazon S3: https://github.com/frugalmechanic/fm-sbt-s3-resolver

It's similar to the already mentioned sbt-s3-resolver but is Apache 2.0 Licensed (instead of AGPL) and is available on Maven Central. It's also a little easier to use and configure.

Publishing to S3

publishTo := Some("S3" at "s3://s3-us-west-2.amazonaws.com/YOUR_BUCKET/repo")

Resolving from S3

resolvers += "S3" at "s3://s3-us-west-2.amazonaws.com/YOUR_BUCKET/repo"

Enable the Plugin

Just add this to your project/plugins.sbt file:

addSbtPlugin("com.frugalmechanic" % "fm-sbt-s3-resolver" % "0.19.0")

Configure AWS Credentials

There are multiple ways to configure the AWS Credentials which are documented on the GitHub Page.

One method is to create an ~/.sbt/.s3credentials that looks like:

accessKey = XXXXXXXXXX
secretKey = XXXXXXXXXX

The credentials file will be automatically picked up by the plugin and you will be able to resolve and publish.