protected static Region getRegion()

in src/main/java/com/amazonaws/codepipeline/jobworker/configuration/DefaultJobWorkerConfiguration.java [107:122]


    protected static Region getRegion() {
        final String awsRegion = System.getProperty(AWS_REGION);
        if (!StringUtils.isNullOrEmpty(awsRegion)) {
            try {
                return Region.getRegion(Regions.fromName(awsRegion));
            } catch (final IllegalArgumentException e) {
                throw new RegionNotFoundException(String.format("Unknown AWS region: '%s'. Choose a valid value for environment variable AWS_REGION", awsRegion), e);
            }
        }

        final Region region = Regions.getCurrentRegion();
        if (region == null) {
            throw new RegionNotFoundException("Region could not be determined from EC2 instance metadata");
        }
        return region;
    }