InstanceNetworkInterfaceSpecification vpc = new InstanceNetworkInterfaceSpecification()
{
SubnetId = "subnet-sadfsadf",
AssociatePublicIpAddress = true,
DeleteOnTermination = false
};
List<InstanceNetworkInterfaceSpecification> temp= new List<InstanceNetworkInterfaceSpecification>();
temp.Add(vpc);
//Create and initialize a RunInstanceRequest
RunInstancesRequest newInstanceRequest = new RunInstancesRequest()
{
ImageId = appdbAMI,
InstanceType = appdbType,
MinCount = 1,
MaxCount = appdbQuantity,
KeyName = ec2Key,
NetworkInsterfaces = temp,
BlockDeviceMappings = resp.Images[0].BlockDeviceMappings
//DisableApiTermination = true
};
这不会将实例启动到具有公共 IP 地址的 vpc 中。它有什么问题?我想将一个实例启动到一个 vpc 中,并为其分配一个公共 IP 地址。