public static boolean isInEc2(InstanceInfo instanceInfo) {
        if (instanceInfo.getDataCenterInfo() instanceof AmazonInfo) {
            String instanceId = ((AmazonInfo) instanceInfo.getDataCenterInfo()).getId();
            if (instanceId != null && instanceId.startsWith("i-")) {
                return true;
            }
        }
        return false;
    }
@Test
    public void testIsInEc2() {
        InstanceInfo instanceInfo1 = new InstanceInfo.Builder(InstanceInfoGenerator.takeOne())
                .setDataCenterInfo(new DataCenterInfo() {
                    @Override
                    public Name getName() {
                        return Name.MyOwn;
                    }
                })
                .build();

        Assert.assertFalse(EurekaUtils.isInEc2(instanceInfo1));

        InstanceInfo instanceInfo2 = InstanceInfoGenerator.takeOne();
        Assert.assertTrue(EurekaUtils.isInEc2(instanceInfo2));
    }