我们正在使用 Alpakka s3 连接器从 VPC 内的本地系统连接到 s3 存储桶并出现如下错误,如果我们使用我们的传统 aws 客户端库,我们能够连接到 s3 并下载文件,我还附上了我们正在使用的示例代码用于 alpakka s3 连接器。这个错误是因为我必须在代码中设置一些 VPC 代理,我用它来处理我们的传统 aws s3 库,但我没有看到 alpakka 提供设置我的 VPC 代理的选项?
错误 - akka.stream.StreamTcpException: Tcp 命令 [Connect(bucket-name.s3.amazonaws.com:443,None,List(),Some(10 seconds),true)] 由于连接超时 Some(10 seconds) 而失败) 已到期
代码 -
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
}
}