Minimal, stream based S3 DSL. Depends on aws-java-sdk-s3.
If you're using SBT, add the following line to your build file:
libraryDependencies += "com.github.wirthan" %% "s3dsl" % <version>
s3dsl provides a function that returns a cats-effect interpreter:
import s3dsl.S3Dsl._
import s3dsl.domain.S3._
import software.amazon.awssdk.services.s3.S3AsyncClient
import software.amazon.awssdk.services.s3.presigner.S3Presigner
val asyncClient = S3AsyncClient.builder()...
val presigner = S3Presigner.builder()...
val s3 = interpreter(asyncClient, presigner)
val path = Path(BucketName("mybucket"), Key("blob.txt"))
val blob = "abc".getBytes
]
val content: Stream[IO, Byte] = for {
_ <- Stream.emits(blob).covary[IO]
.through(s3.putObject(path, blob.length.longValue))
.compile.drain
content <- s3.getObject(path, 1024)
} yield content