NetworkInterfaceProperty Struct
Specifies a network interface that is to be attached to an instance.
You can create a network interface when launching an instance. For an example, see the AWS::EC2::Instance examples .
Alternatively, you can attach an existing network interface when launching an instance. For an example, see the AWS::EC2:NetworkInterface examples .
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const networkInterfaceProperty: ec2.CfnInstance.NetworkInterfaceProperty = {
deviceIndex: 'deviceIndex',
// the properties below are optional
associateCarrierIpAddress: false,
associatePublicIpAddress: false,
deleteOnTermination: false,
description: 'description',
enaSrdSpecification: {
enaSrdEnabled: false,
enaSrdUdpSpecification: {
enaSrdUdpEnabled: false,
},
},
groupSet: ['groupSet'],
ipv6AddressCount: 123,
ipv6Addresses: [{
ipv6Address: 'ipv6Address',
}],
networkInterfaceId: 'networkInterfaceId',
privateIpAddress: 'privateIpAddress',
privateIpAddresses: [{
primary: false,
privateIpAddress: 'privateIpAddress',
}],
secondaryPrivateIpAddressCount: 123,
subnetId: 'subnetId',
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2
network_interface_property = ec2.CfnInstance.NetworkInterfaceProperty(
device_index="deviceIndex",
# the properties below are optional
associate_carrier_ip_address=False,
associate_public_ip_address=False,
delete_on_termination=False,
description="description",
ena_srd_specification=ec2.CfnInstance.EnaSrdSpecificationProperty(
ena_srd_enabled=False,
ena_srd_udp_specification=ec2.CfnInstance.EnaSrdUdpSpecificationProperty(
ena_srd_udp_enabled=False
)
),
group_set=["groupSet"],
ipv6_address_count=123,
ipv6_addresses=[ec2.CfnInstance.InstanceIpv6AddressProperty(
ipv6_address="ipv6Address"
)],
network_interface_id="networkInterfaceId",
private_ip_address="privateIpAddress",
private_ip_addresses=[ec2.CfnInstance.PrivateIpAddressSpecificationProperty(
primary=False,
private_ip_address="privateIpAddress"
)],
secondary_private_ip_address_count=123,
subnet_id="subnetId"
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;
NetworkInterfaceProperty networkInterfaceProperty = NetworkInterfaceProperty.builder()
.deviceIndex("deviceIndex")
// the properties below are optional
.associateCarrierIpAddress(false)
.associatePublicIpAddress(false)
.deleteOnTermination(false)
.description("description")
.enaSrdSpecification(EnaSrdSpecificationProperty.builder()
.enaSrdEnabled(false)
.enaSrdUdpSpecification(EnaSrdUdpSpecificationProperty.builder()
.enaSrdUdpEnabled(false)
.build())
.build())
.groupSet(List.of("groupSet"))
.ipv6AddressCount(123)
.ipv6Addresses(List.of(InstanceIpv6AddressProperty.builder()
.ipv6Address("ipv6Address")
.build()))
.networkInterfaceId("networkInterfaceId")
.privateIpAddress("privateIpAddress")
.privateIpAddresses(List.of(PrivateIpAddressSpecificationProperty.builder()
.primary(false)
.privateIpAddress("privateIpAddress")
.build()))
.secondaryPrivateIpAddressCount(123)
.subnetId("subnetId")
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
var networkInterfaceProperty = new NetworkInterfaceProperty {
DeviceIndex = "deviceIndex",
// the properties below are optional
AssociateCarrierIpAddress = false,
AssociatePublicIpAddress = false,
DeleteOnTermination = false,
Description = "description",
EnaSrdSpecification = new EnaSrdSpecificationProperty {
EnaSrdEnabled = false,
EnaSrdUdpSpecification = new EnaSrdUdpSpecificationProperty {
EnaSrdUdpEnabled = false
}
},
GroupSet = new [] { "groupSet" },
Ipv6AddressCount = 123,
Ipv6Addresses = new [] { new InstanceIpv6AddressProperty {
Ipv6Address = "ipv6Address"
} },
NetworkInterfaceId = "networkInterfaceId",
PrivateIpAddress = "privateIpAddress",
PrivateIpAddresses = new [] { new PrivateIpAddressSpecificationProperty {
Primary = false,
PrivateIpAddress = "privateIpAddress"
} },
SecondaryPrivateIpAddressCount = 123,
SubnetId = "subnetId"
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
networkInterfaceProperty := &NetworkInterfaceProperty{
DeviceIndex: jsii.String("deviceIndex"),
// the properties below are optional
AssociateCarrierIpAddress: jsii.Boolean(false),
AssociatePublicIpAddress: jsii.Boolean(false),
DeleteOnTermination: jsii.Boolean(false),
Description: jsii.String("description"),
EnaSrdSpecification: &EnaSrdSpecificationProperty{
EnaSrdEnabled: jsii.Boolean(false),
EnaSrdUdpSpecification: &EnaSrdUdpSpecificationProperty{
EnaSrdUdpEnabled: jsii.Boolean(false),
},
},
GroupSet: []*string{
jsii.String("groupSet"),
},
Ipv6AddressCount: jsii.Number(123),
Ipv6Addresses: []interface{}{
&InstanceIpv6AddressProperty{
Ipv6Address: jsii.String("ipv6Address"),
},
},
NetworkInterfaceId: jsii.String("networkInterfaceId"),
PrivateIpAddress: jsii.String("privateIpAddress"),
PrivateIpAddresses: []interface{}{
&PrivateIpAddressSpecificationProperty{
Primary: jsii.Boolean(false),
PrivateIpAddress: jsii.String("privateIpAddress"),
},
},
SecondaryPrivateIpAddressCount: jsii.Number(123),
SubnetId: jsii.String("subnetId"),
}
Properties
associateCarrierIpAddressoptionalboolean | IResolvableassociate_carrier_ip_addressoptionaltyping.Union[bool, IResolvable]associateCarrierIpAddressoptionalBooleanAssociateCarrierIpAddressoptionalboolAssociateCarrierIpAddressoptionalinterface{}#notes
You can only assign a carrier IP address to a network interface that is in a subnet in a Wavelength Zone. For more information about carrier IP addresses, see Carrier IP address in the AWS Wavelength Developer Guide .
associatePublicIpAddressoptionalboolean | IResolvableassociate_public_ip_addressoptionaltyping.Union[bool, IResolvable]associatePublicIpAddressoptionalBooleanAssociatePublicIpAddressoptionalboolAssociatePublicIpAddressoptionalinterface{}#notes
Applies only if creating a network interface when launching an instance. The network interface must be the primary network interface. If launching into a default subnet, the default value is true .
AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page .
deleteOnTerminationoptionalboolean | IResolvabledelete_on_terminationoptionaltyping.Union[bool, IResolvable]deleteOnTerminationoptionalBooleanDeleteOnTerminationoptionalboolDeleteOnTerminationoptionalinterface{}#Applies only if creating a network interface when launching an instance.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#Applies only if creating a network interface when launching an instance.
A primary network interface has a device index of 0.
If you create a network interface when launching an instance, you must specify the device index.
enaSrdSpecificationoptionalIResolvable | CfnInstance.EnaSrdSpecificationPropertyena_srd_specificationoptionaltyping.Union[IResolvable, EnaSrdSpecificationProperty]enaSrdSpecificationoptionalIResolvableEnaSrdSpecificationoptionalIResolvableEnaSrdSpecificationoptionalinterface{}#groupSetoptionalstring[]group_setoptionaltyping.List[str]groupSetoptionalList<String>GroupSetoptionalstring[]GroupSetoptional*[]*string#Applies only if creating a network interface when launching an instance.
ipv6AddressCountoptionalnumberipv6_address_countoptionalint | floatipv6AddressCountoptionalNumberIpv6AddressCountoptionaldoubleIpv6AddressCountoptional*float64#notes
Amazon EC2 chooses the IPv6 addresses from the range of the subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.
ipv6AddressesoptionalIResolvable | IResolvable | CfnInstance.InstanceIpv6AddressProperty[]ipv6_addressesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, InstanceIpv6AddressProperty]]]ipv6AddressesoptionalIResolvableIpv6AddressesoptionalIResolvableIpv6Addressesoptionalinterface{}#You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.
networkInterfaceIdoptionalstringnetwork_interface_idoptionalstrnetworkInterfaceIdoptionalStringNetworkInterfaceIdoptionalstringNetworkInterfaceIdoptional*string#privateIpAddressoptionalstringprivate_ip_addressoptionalstrprivateIpAddressoptionalStringPrivateIpAddressoptionalstringPrivateIpAddressoptional*string#Applies only if creating a network interface when launching an instance.
privateIpAddressesoptionalIResolvable | IResolvable | CfnInstance.PrivateIpAddressSpecificationProperty[]private_ip_addressesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, PrivateIpAddressSpecificationProperty]]]privateIpAddressesoptionalIResolvablePrivateIpAddressesoptionalIResolvablePrivateIpAddressesoptionalinterface{}#Only one private IPv4 address can be designated as primary.
secondaryPrivateIpAddressCountoptionalnumbersecondary_private_ip_address_countoptionalint | floatsecondaryPrivateIpAddressCountoptionalNumberSecondaryPrivateIpAddressCountoptionaldoubleSecondaryPrivateIpAddressCountoptional*float64#You can't specify this option and specify more than one private IP address using the private IP addresses option.
subnetIdoptionalstringsubnet_idoptionalstrsubnetIdoptionalStringSubnetIdoptionalstringSubnetIdoptional*string#