class AwsInstanceProfileEC2TrustValidator {

    boolean checkEC2InPrincipals(List<Principal> principals) {
        return principals
                .stream()
                .anyMatch(principal -> "Service".equals(principal.getProvider())
                        && Services.AmazonEC2.getServiceId().equals(principal.getId()));
    }

}