title: Using S3 Java SDK to talk to S3 compatible storage (minio)
body: <p>I am trying to use aws-sdk-java AwsS3client to talk to a minio storage. From the CLI I am able to do:</p>
  
  <pre><code>aws --profile=minioplay  --endpoint-url https://play.minio.io:9000 s3 cp logback.xml s3://miniohstest-jixusroqeb --debug
  </code></pre>
  
  <p>thus using a non default profile and a custom endpoint.
  Not sure how to do this (would I be able to ?) from the java sdk.
  I roughly translated the above <code>awscli</code> command to this scala snippet :</p>
  
  <pre><code>val cred = ...
  val endpoint = "https://play.minio.io:9000"
  val client = AmazonS3ClientBuilder
        .standard()
        .withCredentials(cred)
        .withEndpointConfiguration(
          new EndpointConfiguration(
            endpoint,
            AwsHostNameUtils.parseRegion(endpoint, AmazonS3Client.S3_SERVICE_NAME)
          )
        )
        .build()
  </code></pre>
  
  <p>Using the above client I am only able to make very simple requests such as :</p>
  
  <pre><code>client.listBuckets().asScala.foreach(println(_))
  </code></pre>
  
  <p>which works. But when I try to do something advanced such as :</p>
  
  <pre><code>val listRequest = new ListObjectsRequest()
        .withBucketName("miniohstest-jixusroqeb")
        //.withPrefix(r.getURI.getPath)
        //.withDelimiter(delimiter)
  
  val res = client.listObjects(listRequest)
  res.getObjectSummaries.forEach(x =&gt; println(x.getKey))
  </code></pre>
  
  <p>it throws the following exception :</p>
  
  <pre><code>Exception in thread "main" com.amazonaws.SdkClientException: Unable to execute HTTP request: miniohstest-jixusroqeb.play.minio.io
      at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1114)
      at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1064)
      at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
  </code></pre>
  
  <p>What am I doing wrong?</p>