static String resolveCluster(AwsConfig awsConfig, AwsMetadataApi metadataApi, Environment environment) {
        if (!isNullOrEmptyAfterTrim(awsConfig.getCluster())) {
            return awsConfig.getCluster();
        }
        if (environment.isRunningOnEcs()) {
            String cluster = metadataApi.clusterEcs();
            LOGGER.info("No ECS cluster defined, using current cluster: " + cluster);
            return cluster;
        }
        throw new InvalidConfigurationException("You must define 'cluster' property if not running inside ECS cluster");
    }
@Test(expected = InvalidConfigurationException.class)
    public void resolveClusterInvalidConfiguration() {
        // given
        AwsConfig config = AwsConfig.builder().build();
        Environment environment = mock(Environment.class);
        given(environment.isRunningOnEcs()).willReturn(false);

        // when
        AwsClientConfigurator.resolveCluster(config, null, environment);

        // then
        // throws exception
    }