private String getSlaveFragment(CloudNode slave) {

    String frag = getSlaveFragmentAsString();
    String name = slave.getPrivateDNS();
    name = name.replace(".compute-1.internal", "");
    name = name.replace(".ec2.internal", "");
    frag = frag.replace("$SLAVE_PRIVATE_DNS", name);
    frag = frag.replace("$SLAVE_PRIVATE_IP", slave.getPrivateIp());
    return frag;
  }
  private String generateTopology(String template) {

    String topology = template;
    String name = master.getPrivateDNS();
    name = name.replace(".compute-1.internal", "");
    name = name.replace(".ec2.internal", "");
    // in the chef recipe, "name" was node['hostname']
    topology = topology.replace("$MASTER_PRIVATE_DNS", name);
    topology = topology.replace("$MASTER_PRIVATE_IP", master.getPrivateIp());

    StringBuilder slavesXml = new StringBuilder("");
    for (CloudNode slave : slaves) {
      String frag = getSlaveFragment(slave);
      slavesXml.append("\n").append(frag);
    }

    return topology.replace("$SLAVES", slavesXml);
  }