SecurityGroupBuilder builder = SecurityGroupBuilder.fromSecurityGroup(checkNotNull(group, "group"));
builder.ipPermissions();
builder.ipPermissions(filter(group.getIpPermissions(), not(equalTo(perm))));
SecurityGroup newGroup = builder.build();
if (groups.containsKey(newGroup.getId())) {
groups.remove(newGroup.getId());