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
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.