NetworkInterface

Provides an Elastic network interface (ENI) resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var test = new Aws.Ec2.NetworkInterface("test", new Aws.Ec2.NetworkInterfaceArgs
        {
            SubnetId = aws_subnet.Public_a.Id,
            PrivateIps = 
            {
                "10.0.0.50",
            },
            SecurityGroups = 
            {
                aws_security_group.Web.Id,
            },
            Attachments = 
            {
                new Aws.Ec2.Inputs.NetworkInterfaceAttachmentArgs
                {
                    Instance = aws_instance.Test.Id,
                    DeviceIndex = 1,
                },
            },
        });
    }

}

Coming soon!

import pulumi
import pulumi_aws as aws

test = aws.ec2.NetworkInterface("test",
    subnet_id=aws_subnet["public_a"]["id"],
    private_ips=["10.0.0.50"],
    security_groups=[aws_security_group["web"]["id"]],
    attachments=[aws.ec2.NetworkInterfaceAttachmentArgs(
        instance=aws_instance["test"]["id"],
        device_index=1,
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const test = new aws.ec2.NetworkInterface("test", {
    subnetId: aws_subnet.public_a.id,
    privateIps: ["10.0.0.50"],
    securityGroups: [aws_security_group.web.id],
    attachments: [{
        instance: aws_instance.test.id,
        deviceIndex: 1,
    }],
});

Create a NetworkInterface Resource

new NetworkInterface(name: string, args: NetworkInterfaceArgs, opts?: CustomResourceOptions);
@overload
def NetworkInterface(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     attachments: Optional[Sequence[NetworkInterfaceAttachmentArgs]] = None,
                     description: Optional[str] = None,
                     ipv6_address_count: Optional[int] = None,
                     ipv6_addresses: Optional[Sequence[str]] = None,
                     private_ip: Optional[str] = None,
                     private_ips: Optional[Sequence[str]] = None,
                     private_ips_count: Optional[int] = None,
                     security_groups: Optional[Sequence[str]] = None,
                     source_dest_check: Optional[bool] = None,
                     subnet_id: Optional[str] = None,
                     tags: Optional[Mapping[str, str]] = None,
                     tags_all: Optional[Mapping[str, str]] = None)
@overload
def NetworkInterface(resource_name: str,
                     args: NetworkInterfaceArgs,
                     opts: Optional[ResourceOptions] = None)
func NewNetworkInterface(ctx *Context, name string, args NetworkInterfaceArgs, opts ...ResourceOption) (*NetworkInterface, error)
public NetworkInterface(string name, NetworkInterfaceArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args NetworkInterfaceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args NetworkInterfaceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args NetworkInterfaceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args NetworkInterfaceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

NetworkInterface Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The NetworkInterface resource accepts the following input properties:

SubnetId string
Subnet ID to create the ENI in.
Attachments List<NetworkInterfaceAttachmentArgs>
Block to define the attachment of the ENI. Documented below.
Description string
A description for the network interface.
Ipv6AddressCount int
The number of IPv6 addresses to assign to a network interface. You can’t use this option if specifying specific ipv6_addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.
Ipv6Addresses List<string>
One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can’t use this option if you’re specifying ipv6_address_count.
PrivateIp string
PrivateIps List<string>
List of private IPs to assign to the ENI.
PrivateIpsCount int
Number of secondary private IPs to assign to the ENI. The total number of private IPs will be 1 + private_ips_count, as a primary private IP will be assiged to an ENI by default.
SecurityGroups List<string>
List of security group IDs to assign to the ENI.
SourceDestCheck bool
Whether to enable source destination checking for the ENI. Default true.
Tags Dictionary<string, string>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider .
SubnetId string
Subnet ID to create the ENI in.
Attachments []NetworkInterfaceAttachmentType
Block to define the attachment of the ENI. Documented below.
Description string
A description for the network interface.
Ipv6AddressCount int
The number of IPv6 addresses to assign to a network interface. You can’t use this option if specifying specific ipv6_addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.
Ipv6Addresses []string
One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can’t use this option if you’re specifying ipv6_address_count.
PrivateIp string
PrivateIps []string
List of private IPs to assign to the ENI.
PrivateIpsCount int
Number of secondary private IPs to assign to the ENI. The total number of private IPs will be 1 + private_ips_count, as a primary private IP will be assiged to an ENI by default.
SecurityGroups []string
List of security group IDs to assign to the ENI.
SourceDestCheck bool
Whether to enable source destination checking for the ENI. Default true.
Tags map[string]string
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider .
subnetId string
Subnet ID to create the ENI in.
attachments NetworkInterfaceAttachmentArgs[]
Block to define the attachment of the ENI. Documented below.
description string
A description for the network interface.
ipv6AddressCount number
The number of IPv6 addresses to assign to a network interface. You can’t use this option if specifying specific ipv6_addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.
ipv6Addresses string[]
One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can’t use this option if you’re specifying ipv6_address_count.
privateIp string
privateIps string[]
List of private IPs to assign to the ENI.
privateIpsCount number
Number of secondary private IPs to assign to the ENI. The total number of private IPs will be 1 + private_ips_count, as a primary private IP will be assiged to an ENI by default.
securityGroups string[]
List of security group IDs to assign to the ENI.
sourceDestCheck boolean
Whether to enable source destination checking for the ENI. Default true.
tags {[key: string]: string}
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider .
subnet_id str
Subnet ID to create the ENI in.
attachments Sequence[NetworkInterfaceAttachmentArgs]
Block to define the attachment of the ENI. Documented below.
description str
A description for the network interface.
ipv6_address_count int
The number of IPv6 addresses to assign to a network interface. You can’t use this option if specifying specific ipv6_addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.
ipv6_addresses Sequence[str]
One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can’t use this option if you’re specifying ipv6_address_count.
private_ip str
private_ips Sequence[str]
List of private IPs to assign to the ENI.
private_ips_count int
Number of secondary private IPs to assign to the ENI. The total number of private IPs will be 1 + private_ips_count, as a primary private IP will be assiged to an ENI by default.
security_groups Sequence[str]
List of security group IDs to assign to the ENI.
source_dest_check bool
Whether to enable source destination checking for the ENI. Default true.
tags Mapping[str, str]
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider .

Outputs

All input properties are implicitly available as output properties. Additionally, the NetworkInterface resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
MacAddress string
The MAC address of the network interface.
OutpostArn string
PrivateDnsName string
The private DNS name of the network interface (IPv4).
Id string
The provider-assigned unique ID for this managed resource.
MacAddress string
The MAC address of the network interface.
OutpostArn string
PrivateDnsName string
The private DNS name of the network interface (IPv4).
id string
The provider-assigned unique ID for this managed resource.
macAddress string
The MAC address of the network interface.
outpostArn string
privateDnsName string
The private DNS name of the network interface (IPv4).
id str
The provider-assigned unique ID for this managed resource.
mac_address str
The MAC address of the network interface.
outpost_arn str
private_dns_name str
The private DNS name of the network interface (IPv4).

Look up an Existing NetworkInterface Resource

Get an existing NetworkInterface resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NetworkInterfaceState, opts?: CustomResourceOptions): NetworkInterface
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        attachments: Optional[Sequence[NetworkInterfaceAttachmentArgs]] = None,
        description: Optional[str] = None,
        ipv6_address_count: Optional[int] = None,
        ipv6_addresses: Optional[Sequence[str]] = None,
        mac_address: Optional[str] = None,
        outpost_arn: Optional[str] = None,
        private_dns_name: Optional[str] = None,
        private_ip: Optional[str] = None,
        private_ips: Optional[Sequence[str]] = None,
        private_ips_count: Optional[int] = None,
        security_groups: Optional[Sequence[str]] = None,
        source_dest_check: Optional[bool] = None,
        subnet_id: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> NetworkInterface
func GetNetworkInterface(ctx *Context, name string, id IDInput, state *NetworkInterfaceState, opts ...ResourceOption) (*NetworkInterface, error)
public static NetworkInterface Get(string name, Input<string> id, NetworkInterfaceState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Attachments List<NetworkInterfaceAttachmentArgs>
Block to define the attachment of the ENI. Documented below.
Description string
A description for the network interface.
Ipv6AddressCount int
The number of IPv6 addresses to assign to a network interface. You can’t use this option if specifying specific ipv6_addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.
Ipv6Addresses List<string>
One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can’t use this option if you’re specifying ipv6_address_count.
MacAddress string
The MAC address of the network interface.
OutpostArn string
PrivateDnsName string
The private DNS name of the network interface (IPv4).
PrivateIp string
PrivateIps List<string>
List of private IPs to assign to the ENI.
PrivateIpsCount int
Number of secondary private IPs to assign to the ENI. The total number of private IPs will be 1 + private_ips_count, as a primary private IP will be assiged to an ENI by default.
SecurityGroups List<string>
List of security group IDs to assign to the ENI.
SourceDestCheck bool
Whether to enable source destination checking for the ENI. Default true.
SubnetId string
Subnet ID to create the ENI in.
Tags Dictionary<string, string>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider .
Attachments []NetworkInterfaceAttachmentType
Block to define the attachment of the ENI. Documented below.
Description string
A description for the network interface.
Ipv6AddressCount int
The number of IPv6 addresses to assign to a network interface. You can’t use this option if specifying specific ipv6_addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.
Ipv6Addresses []string
One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can’t use this option if you’re specifying ipv6_address_count.
MacAddress string
The MAC address of the network interface.
OutpostArn string
PrivateDnsName string
The private DNS name of the network interface (IPv4).
PrivateIp string
PrivateIps []string
List of private IPs to assign to the ENI.
PrivateIpsCount int
Number of secondary private IPs to assign to the ENI. The total number of private IPs will be 1 + private_ips_count, as a primary private IP will be assiged to an ENI by default.
SecurityGroups []string
List of security group IDs to assign to the ENI.
SourceDestCheck bool
Whether to enable source destination checking for the ENI. Default true.
SubnetId string
Subnet ID to create the ENI in.
Tags map[string]string
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider .
attachments NetworkInterfaceAttachmentArgs[]
Block to define the attachment of the ENI. Documented below.
description string
A description for the network interface.
ipv6AddressCount number
The number of IPv6 addresses to assign to a network interface. You can’t use this option if specifying specific ipv6_addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.
ipv6Addresses string[]
One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can’t use this option if you’re specifying ipv6_address_count.
macAddress string
The MAC address of the network interface.
outpostArn string
privateDnsName string
The private DNS name of the network interface (IPv4).
privateIp string
privateIps string[]
List of private IPs to assign to the ENI.
privateIpsCount number
Number of secondary private IPs to assign to the ENI. The total number of private IPs will be 1 + private_ips_count, as a primary private IP will be assiged to an ENI by default.
securityGroups string[]
List of security group IDs to assign to the ENI.
sourceDestCheck boolean
Whether to enable source destination checking for the ENI. Default true.
subnetId string
Subnet ID to create the ENI in.
tags {[key: string]: string}
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider .
attachments Sequence[NetworkInterfaceAttachmentArgs]
Block to define the attachment of the ENI. Documented below.
description str
A description for the network interface.
ipv6_address_count int
The number of IPv6 addresses to assign to a network interface. You can’t use this option if specifying specific ipv6_addresses. If your subnet has the AssignIpv6AddressOnCreation attribute set to true, you can specify 0 to override this setting.
ipv6_addresses Sequence[str]
One or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. You can’t use this option if you’re specifying ipv6_address_count.
mac_address str
The MAC address of the network interface.
outpost_arn str
private_dns_name str
The private DNS name of the network interface (IPv4).
private_ip str
private_ips Sequence[str]
List of private IPs to assign to the ENI.
private_ips_count int
Number of secondary private IPs to assign to the ENI. The total number of private IPs will be 1 + private_ips_count, as a primary private IP will be assiged to an ENI by default.
security_groups Sequence[str]
List of security group IDs to assign to the ENI.
source_dest_check bool
Whether to enable source destination checking for the ENI. Default true.
subnet_id str
Subnet ID to create the ENI in.
tags Mapping[str, str]
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider .

Supporting Types

NetworkInterfaceAttachment

DeviceIndex int
Integer to define the devices index.
Instance string
ID of the instance to attach to.
AttachmentId string
DeviceIndex int
Integer to define the devices index.
Instance string
ID of the instance to attach to.
AttachmentId string
deviceIndex number
Integer to define the devices index.
instance string
ID of the instance to attach to.
attachmentId string
device_index int
Integer to define the devices index.
instance str
ID of the instance to attach to.
attachment_id str

Import

Network Interfaces can be imported using the id, e.g.

 $ pulumi import aws:ec2/networkInterface:NetworkInterface test eni-e5aa89a3

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.