aws-sdk-java icon indicating copy to clipboard operation
aws-sdk-java copied to clipboard

Set region for AmazonElasticTranscoder

Open nikolaynest opened this issue 8 years ago • 1 comments

Trying to set region in AmazonElasticTranscoder I found it deprecated and there is the link in java docs to use {@link AwsClientBuilder#setRegion(String)} After several attempts and searches my code looks like this: String region = "us-east-1"; AwsClientBuilder awsClientBuilder = AmazonElasticTranscoderClientBuilder.standard(); awsClientBuilder.setRegion(region); AmazonElasticTranscoder amazonElasticTranscoder = ((AmazonElasticTranscoderClientBuilder) awsClientBuilder).defaultClient(); But I steel get an error:

Caused by: com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.

P.S. My issue is how to create AmazonElasticTranscoderClient

nikolaynest avatar May 15 '18 11:05 nikolaynest

You had it almost right but you overrode the builder at the end by calling defaultClient(). The following is what you are looking for:

AmazonElasticTranscoder client = AmazonElasticTranscoderClientBuilder.standard().withRegion(region).build();

spfink avatar May 15 '18 16:05 spfink