Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to publish to Amazon S3 with sbt

Tags:

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?

like image 257
Oscar Picasso Avatar asked Mar 31 '12 17:03

Oscar Picasso


People also ask

How do I upload files to AWS S3?

In the Amazon S3 console, choose the bucket where you want to upload an object, choose Upload, and then choose Add Files. In the file selection dialog box, find the file that you want to upload, choose it, choose Open, and then choose Start Upload. You can watch the progress of the upload in the Transfer pane.

What is the maximum size of a file that you can upload to an Amazon S3 bucket?

The maximum size of a file that you can upload by using the Amazon S3 console is 160 GB. To upload a file larger than 160 GB, use the AWS CLI, AWS SDK, or Amazon S3 REST API.


2 Answers

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.

like image 122
tpunder Avatar answered Oct 23 '22 22:10

tpunder


The question is pretty old, so may be you already found some workaround, but may be this answer will be useful for somebody else.

We also had such problem in our team and we just created an sbt-plugin for that: sbt-s3-resolver. We were using it for a while and it seems to do it's work fine. It can

  • publish ivy/maven artifacts to S3 (private/public) buckets
  • resolve ivy artifacts from private buckets (because from public buckets you can resolver with standard sbt resolvers)

Take a look at the usage instructions in readme and open an issue if something is missing.

like image 39
laughedelic Avatar answered Oct 23 '22 20:10

laughedelic