2017-07-12 4 views
0

私のプロジェクトでは、java aws sdk version 1.11.30を使用しています。 SDKで利用できない地域のサポートを追加する必要があります。私は私の検索https://aws.amazon.com/blogs/developer/using-new-regions-and-endpoints/Java AWS SDKでベースURLを設定するにはどうすればよいですか?

でこれを発見したことに関連し

はしかし、私は、Java SDKでそれを行うするかどうかはわかりません。

は、私は現在、S3インスタンス以下のように取得する:

AmazonS3 s3 = AmazonS3ClientBuilder.standard() 
     .withRegion(regionName) //regionName is a string for a region not supported by the SDK yet 
     .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(aKeyUpload, sKeyUpload))) 
     .build() 

質問私はそれが上記のリンクに記載されているのと同じようにベースURLを設定するにはどうすればよい

+0

Java SDKのそのバージョンではサポートされていないリージョンはどれですか?最新のSDKにアップグレードできない理由は何ですか? – jarmod

+0

これらの領域はC2Sです。 SDKの最新バージョンへのアップグレードは役に立ちません – Anthony

答えて

1

私は、これは非常に最新の(2.xの)AWSクライアントで変更されていますが、1.11で、あなたが行うことができるはずと信じています。また

AmazonS3ClientBuilder.standard().setEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("endpoint", "region")) 

http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/client/builder/AwsClientBuilder.html

、あなたがする必要があります

AmazonS3 s3 = AmazonS3ClientBuilder.standard() 
    .withRegion(regionName) //regionName is a string for a region not supported by the SDK yet 
    .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(aKeyUpload, sKeyUpload))) 
    .build() 
s3.setEndpoint("https://s3.eu-west-1.amazonaws.com"); 
+0

2.xリリースはありますか?私はgithubには表示されませんhttps://github.com/aws/aws-sdk-java/releases – Anthony

+0

また、SDKはendpoints.json https://github.com/aws/aws-sdk- java/blob/1.11.30/aws-java-sdk-core/src/main/resources/com/amazonaws/partitions/endpoints.jsonしかし、私のアプリケーションのWARファイルでは、endpoints.jsonは表示されません。それが私のプロジェクトに追加する必要があるのか​​、それとも 'setEndpointConfiguration'で十分であるのか分かりますか? – Anthony

+0

V2はまだリリースされていません:https://github.com/aws/aws-sdk-java-v2 –

関連する問題