aws-cdk-lib.aws_ec2.CfnInstance.NetworkInterfaceProperty

interface NetworkInterfaceProperty

LanguageType name
.NETAmazon.CDK.AWS.EC2.CfnInstance.NetworkInterfaceProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#CfnInstance_NetworkInterfaceProperty
Javasoftware.amazon.awscdk.services.ec2.CfnInstance.NetworkInterfaceProperty
Pythonaws_cdk.aws_ec2.CfnInstance.NetworkInterfaceProperty
TypeScript aws-cdk-lib » aws_ec2 » CfnInstance » NetworkInterfaceProperty

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',
  groupSet: ['groupSet'],
  ipv6AddressCount: 123,
  ipv6Addresses: [{
    ipv6Address: 'ipv6Address',
  }],
  networkInterfaceId: 'networkInterfaceId',
  privateIpAddress: 'privateIpAddress',
  privateIpAddresses: [{
    primary: false,
    privateIpAddress: 'privateIpAddress',
  }],
  secondaryPrivateIpAddressCount: 123,
  subnetId: 'subnetId',
};

Properties

NameTypeDescription
deviceIndexstringThe position of the network interface in the attachment order.
associateCarrierIpAddress?boolean | IResolvableIndicates whether to assign a carrier IP address to the network interface.
associatePublicIpAddress?boolean | IResolvableIndicates whether to assign a public IPv4 address to an instance.
deleteOnTermination?boolean | IResolvableIndicates whether the network interface is deleted when the instance is terminated.
description?stringThe description of the network interface.
groupSet?string[]The IDs of the security groups for the network interface.
ipv6AddressCount?numberA number of IPv6 addresses to assign to the network interface.
ipv6Addresses?IResolvable | IResolvable | InstanceIpv6AddressProperty[]The IPv6 addresses to assign to the network interface.
networkInterfaceId?stringThe ID of the network interface, when attaching an existing network interface.
privateIpAddress?stringThe private IPv4 address of the network interface.
privateIpAddresses?IResolvable | IResolvable | PrivateIpAddressSpecificationProperty[]One or more private IPv4 addresses to assign to the network interface.
secondaryPrivateIpAddressCount?numberThe number of secondary private IPv4 addresses.
subnetId?stringThe ID of the subnet associated with the network interface.

deviceIndex

Type: string

The position of the network interface in the attachment order.

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.


associateCarrierIpAddress?

Type: boolean | IResolvable (optional)

Indicates whether to assign a carrier IP address to the network interface.

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 .


associatePublicIpAddress?

Type: boolean | IResolvable (optional)

Indicates whether to assign a public IPv4 address to an instance.

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 .


deleteOnTermination?

Type: boolean | IResolvable (optional)

Indicates whether the network interface is deleted when the instance is terminated.

Applies only if creating a network interface when launching an instance.


description?

Type: string (optional)

The description of the network interface.

Applies only if creating a network interface when launching an instance.


groupSet?

Type: string[] (optional)

The IDs of the security groups for the network interface.

Applies only if creating a network interface when launching an instance.


ipv6AddressCount?

Type: number (optional)

A number of IPv6 addresses to assign to the network interface.

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.


ipv6Addresses?

Type: IResolvable | IResolvable | InstanceIpv6AddressProperty[] (optional)

The IPv6 addresses to assign to the network interface.

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.


networkInterfaceId?

Type: string (optional)

The ID of the network interface, when attaching an existing network interface.


privateIpAddress?

Type: string (optional)

The private IPv4 address of the network interface.

Applies only if creating a network interface when launching an instance.


privateIpAddresses?

Type: IResolvable | IResolvable | PrivateIpAddressSpecificationProperty[] (optional)

One or more private IPv4 addresses to assign to the network interface.

Only one private IPv4 address can be designated as primary.


secondaryPrivateIpAddressCount?

Type: number (optional)

The number of secondary private IPv4 addresses.

You can't specify this option and specify more than one private IP address using the private IP addresses option.


subnetId?

Type: string (optional)

The ID of the subnet associated with the network interface.

Applies only if creating a network interface when launching an instance.