# Alpakka S3: difficulty migrating to redesigned API?

**URL:** <https://discuss.akka.io/t/alpakka-s3-difficulty-migrating-to-redesigned-api/5627>\
**Category:** Akka Streams & Alpakka\
**Created:** [December 19, 2019, 12:30am UTC](https://discuss.akka.io/t/alpakka-s3-difficulty-migrating-to-redesigned-api/5627 "2019-12-19T00:30:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peternitro](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@peternitro](https://discuss.akka.io/u/peternitro)\
**Post date:** [December 19, 2019, 12:30am UTC](https://discuss.akka.io/t/alpakka-s3-difficulty-migrating-to-redesigned-api/5627/1 "2019-12-19T00:30:31Z")

</div>

I inherited a codebase that was developed against 0.20, need to migrate to 1.x because of binary interface changes within Akka.

It looks like the Alpakka S3 connector API changed significantly, I’m able to squeeze the new connector in the existing doing something like this (untested still because of trouble below):

```auto
    override def provide(key: String): Source[ByteString, NotUsed] = {
      S3.download(bucket.getName, key).flatMapMerge(1, { _.fold(Source.empty[ByteString])(_._1) })
    }

```

however, upgrading the automated tests which are run against [https://github.com/findify/s3mock](https://github.com/findify/s3mock), the S3Mock is started with a free port chosen at runtime.

Previously it was simple to inject a custom configuration (they can differ per test) into S3Client and away you go, now one appears to be limited to:

1. **application.conf**
2. adding a custom **.withAttributes** on every API call?

Neither of these ways is convenient at all, there appears to be no simple way to create & inject settings programmatically once per test?

I suppose this was driven by the design decision to expose the API as object rather than instance methods. What about adding an implicit to the public API for settings to make this a bit less painful? Am I missing something huge?

Thanks  
Peter

---

<div class="post-metadata">

**Author:** ![peternitro](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@peternitro](https://discuss.akka.io/u/peternitro)\
**Post date:** [December 19, 2019, 1:30am UTC](https://discuss.akka.io/t/alpakka-s3-difficulty-migrating-to-redesigned-api/5627/2 "2019-12-19T01:30:39Z")

</div>

I guess another way may be to recreate the ActorSystem every test and inject a Config

---

<div class="post-metadata">

**Author:** ![ennru](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/ennru/32/1495_2.png) [@ennru](https://discuss.akka.io/u/ennru)\
**Post date:** [December 20, 2019, 10:24am UTC](https://discuss.akka.io/t/alpakka-s3-difficulty-migrating-to-redesigned-api/5627/3 "2019-12-20T10:24:00Z")

</div>

Yes, passing different config to the `ActorSystem` is a good approach.

That’s what we do in [our S3 tests](https://github.com/akka/alpakka/blob/42363b6ef05cdd4a4b7620938185d59e5f02c0a4/s3/src/test/scala/akka/stream/alpakka/s3/scaladsl/S3IntegrationSpec.scala#L503-L515)

Cheers,  
Enno.
