简体   繁体   English

如何为 java AmazonS3 客户端设置端点?

[英]How to set endpoint for java AmazonS3 client?

I have a cloud store, made our devops engineers.我有一个云存储,做了我们的 devops 工程师。 They gave me an address of its balancer: https://bla-bla-bla.company.com:9000 , access-key: 1234567, secret-key: 7654321, bucket-name: bucketName.他们给了我平衡器的地址: https://bla-bla-bla.company.com:9000 ,访问密钥:1234567,密钥:7654321,桶名:桶名。 Using minio client I can create a client like this:使用 minio 客户端我可以创建一个这样的客户端:

MinioClient.builder()
          .endpoint("https://bla-bla-bla.company.com:9000")
          .credentials("1234567", "7654321")
          .build();

But AmazonS3 client works like this:但 AmazonS3 客户端的工作方式如下:

AWSCredentials credentials = new BasicAWSCredentials("1234567", "7654321");

return AmazonS3ClientBuilder
    .standard()
    .withCredentials(new AWSStaticCredentialsProvider(credentials))
    .withRegion(Regions.US_WEST_2) 
    .build();

How to set my endpoint to it?如何将我的端点设置为它?

return AmazonS3ClientBuilder.standard().withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration( "your_endpoint", "region")).withCredentials(new AWSStaticCredentialsProvider(credentials)).build(); return AmazonS3ClientBuilder.standard().withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("your_endpoint", "region")).withCredentials(new AWSStaticCredentialsProvider(credentials)).build();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM