0

We are using Alpakka s3 connector to connect to s3 bucket from local system within VPC and getting error as below ,if we use our tradition aws client library we are able to connect to s3 and download file , I am also attaching sample code we are using for alpakka s3 connector. Is this error because i have to setup some VPC proxy in Code which i use to do with our traditional aws s3 library but i dont see alpakka give option to setup my VPC proxy ?

Error - akka.stream.StreamTcpException: Tcp command [Connect(bucket-name.s3.amazonaws.com:443,None,List(),Some(10 seconds),true)] failed because of Connect timeout of Some(10 seconds) expired

Code -

  override def main(args: Array[String]): Unit = {
  implicit val system = ActorSystem()
  implicit val materializer = ActorMaterializer()
  implicit val executionContext: ExecutionContext = 
  ExecutionContext.Implicits.global

  val awsCredentialsProvider = new AWSStaticCredentialsProvider(
  new BasicSessionCredentials("xxxxxx", "xxxx", "xxxx")
  )
  val regionProvider =
  new AwsRegionProvider {
    def getRegion: String = "us-east-1"
  }
  val settings =
  new S3Settings(MemoryBufferType, None, awsCredentialsProvider, 
  regionProvider, false, None, ListBucketVersion2)
  val s3Client = new S3Client(settings)(system, materializer)
  val future = s3Client.download("bucket_name", "Data/abc.txt", None, 
  Some(ServerSideEncryption.AES256)) 
  future._2.onComplete {
    case Success(value) => println(s"Got the callback, meaning = 
   value")
    case Failure(e) => e.printStackTrace
  }
  }
Learner
  • 45
  • 1
  • 6

1 Answers1

0

You can provide proxy settings in application.conf. Load this config, and provide it to your ActorSystem(name, config) as the config.

akka.stream.alpakka.s3 {
  proxy {
    host = ""
    port = 8000
    # use https?
    secure = true
  }
}

any of the following configuration settings can be overridden in your application.conf: https://github.com/akka/alpakka/blob/master/s3/src/main/resources/reference.conf#L8

emran
  • 902
  • 6
  • 12
  • Thanks for your response , I am getting this proxy error only when i try to connect from my local system to AWS enviornment which is in private VPC , if i give proxy as mentioned above it will create my http URL based on that host...in my case i want to setup some proxy like "proxy.abc.company.com" and once i seup my proxy then my bucket url will still be "buket-name.s3.amazonaws.com".. – Learner Jun 20 '18 at 11:42