使用Apache JClouds时,如何启动有公网IP的计算实例?这不同于弹性IP。使用官方AWS API,您可以执行以下操作:
//create network information
InstanceNetworkInterfaceSpecification networkWithPublicIp = new InstanceNetworkInterfaceSpecification()
.withSubnetId(subnetId)
.withAssociatePublicIpAddress(true)
.withGroups( securityGroupIds )
.withDeviceIndex(0);节点启动后,会有一个随机分配的公网IP (非弹性)。有没有办法用Jcloud和AWSEC2TemplateOptions做到这一点?
发布于 2018-08-24 05:05:49
在http://jclouds.apache.org/guides/aws/的文档中有一个示例
// ex. to get an ip and associate it with a node
String ip = ec2Client.getElasticIPAddressServices().allocateAddressInRegion(node.getLocation().getId());
ec2Client.getElasticIPAddressServices().associateAddressInRegion(node.getLocation().getId(),ip, node.getProviderId());https://stackoverflow.com/questions/51957284
复制相似问题