class AwsMetadataCollector implements MetadataCollector {

    @Override
    public List<CloudVmMetaDataStatus> collect(AuthenticatedContext ac, List<CloudResource> resources, List<CloudInstance> vms,
            List<CloudInstance> allInstances) {
        LOGGER.debug("Collect AWS instance metadata, for cluster {} resources: {}, vms: {}, allInstances: {}",
                ac.getCloudContext().getName(), resources.size(), vms.size(), allInstances.size());
        try {
            List<String> knownInstanceIdList = allInstances.stream()
                    .filter(cloudInstance -> cloudInstance.getInstanceId() != null)
                    .map(CloudInstance::getInstanceId)
                    .collect(Collectors.toList());

            return collectCloudVmMetaDataStatuses(ac, vms, knownInstanceIdList);
        } catch (RuntimeException e) {
            throw new CloudConnectorException(e.getMessage(), e);
        }
    }

}