* "Did not find network interface after attaching: " +
* created.getNetworkInterfaceId()); }
*/
}
InstancePrivateIpAddress privateIp = findUnusedIp(networkInterface);
if (privateIp == null) {
// TODO: Prune private ip addresses from NICs?
// TODO: Need to tag??
{
AssignPrivateIpAddressesRequest request = new AssignPrivateIpAddressesRequest();
request.setNetworkInterfaceId(networkInterface.getNetworkInterfaceId());
request.setSecondaryPrivateIpAddressCount(1);
ec2.assignPrivateIpAddresses(request);
}
ec2Instance = describeInstance(ec2, ec2InstanceId);
networkInterface = findNetworkInterface(ec2Instance, networkInterfaceIndex);
privateIp = findUnusedIp(networkInterface);
if (privateIp == null) {
throw new IllegalStateException("Unable to find private IP address");
}
}
String privateIpAddress = privateIp.getPrivateIpAddress();
{
AssociateAddressRequest request = new AssociateAddressRequest();
request.setPublicIp(vip.getData().getIp());
request.setPrivateIpAddress(privateIpAddress);