class AwsEC2Platform extends Platform implements SshBasedExperiment<AwsEC2Container> {

    public Map<String, Set<String>> getNetworkInterfaceToSecurityGroupsMap (String instanceId) {
        log.debug("Looking up security groups for instance {}", instanceId);
        return amazonEC2.describeNetworkInterfaces(new DescribeNetworkInterfacesRequest().withFilters(new Filter("attachment.instance-id", List
                .of(instanceId))))
                        .getNetworkInterfaces()
                        .stream()
                        .collect(Collectors.groupingBy(NetworkInterface::getNetworkInterfaceId, Collectors.flatMapping((Function<? super NetworkInterface, ? extends Stream<String>>) networkInterface -> networkInterface
                                .getGroups()
                                .stream()
                                .map(GroupIdentifier::getGroupId), Collectors.toSet())));
    }

    @Autowired  AwsEC2Platform(AmazonEC2 amazonEC2, ContainerManager containerManager, AwsEC2SelfAwareness awsEC2SelfAwareness);
    private  AwsEC2Platform();

}