Search code examples
javaamazon-web-servicesaws-sdk-java-2.0amazon-systems-manager

Is it absolutely necessary to explicitely mention region while building SsmClient using aws sdk for java v2?


So basically I want to know what will if we don't mention the region or if mention the region incorrectly

SsmClient ssmClient = SsmClient.builder()
                .region(region)
                .build();

I was expecting that if region is not set then it should not throw any error and will search all regions for the ssm parameter


Solution

  • It's not necessary if you have the region set somewhere else, like in an environment variable. You have to specify a region somehow though. The AWS SDK does not search all regions automatically when you try to reference a resource without a region specified.