Home > other >  Unable to find a region using the region provider chain. Must provide an explicit region in the buil
Unable to find a region using the region provider chain. Must provide an explicit region in the buil

Time:05-07

I am using the AWS Java SDK v1 to access a Step Function.

Unfortunately I am getting this error about the region.

In my script file I defined like this.

private AWSStepFunctions client;
this.client = AWSStepFunctionsClientBuilder.defaultClient();

In application.properties I defined like this.

cloud.aws.region.static=eu-central-1
aws.region=eu-central-1

CodePudding user response:

The code you are using is an old API and no longer considered best practice. Amazon Strongly recommends using V2 over V1.

The way you are creating a service client is outdated too. To programmatically work with AWS Step Functions, consider using the recommended API - which is AWS SDK for Java v2.

To create an AWS Step Functions Service Client and specify the Region, use Java code like this:

 Region region = Region.US_EAST_1;
 SfnClient sfnClient = SfnClient.builder()
           .region(region)
            .build();

See the AWS Step Functions Readme here for more set up instructions for AWS SDK Java V2.

  • Related