1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. getNetworkInterface
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.ec2.getNetworkInterface

Explore with Pulumi AI

Use this data source to get information about a Network Interface.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const bar = aws.ec2.getNetworkInterface({
    id: "eni-01234567",
});
Copy
import pulumi
import pulumi_aws as aws

bar = aws.ec2.get_network_interface(id="eni-01234567")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.LookupNetworkInterface(ctx, &ec2.LookupNetworkInterfaceArgs{
			Id: pulumi.StringRef("eni-01234567"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var bar = Aws.Ec2.GetNetworkInterface.Invoke(new()
    {
        Id = "eni-01234567",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetNetworkInterfaceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var bar = Ec2Functions.getNetworkInterface(GetNetworkInterfaceArgs.builder()
            .id("eni-01234567")
            .build());

    }
}
Copy
variables:
  bar:
    fn::invoke:
      function: aws:ec2:getNetworkInterface
      arguments:
        id: eni-01234567
Copy

Using getNetworkInterface

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getNetworkInterface(args: GetNetworkInterfaceArgs, opts?: InvokeOptions): Promise<GetNetworkInterfaceResult>
function getNetworkInterfaceOutput(args: GetNetworkInterfaceOutputArgs, opts?: InvokeOptions): Output<GetNetworkInterfaceResult>
Copy
def get_network_interface(filters: Optional[Sequence[GetNetworkInterfaceFilter]] = None,
                          id: Optional[str] = None,
                          tags: Optional[Mapping[str, str]] = None,
                          opts: Optional[InvokeOptions] = None) -> GetNetworkInterfaceResult
def get_network_interface_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetNetworkInterfaceFilterArgs]]]] = None,
                          id: Optional[pulumi.Input[str]] = None,
                          tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetNetworkInterfaceResult]
Copy
func LookupNetworkInterface(ctx *Context, args *LookupNetworkInterfaceArgs, opts ...InvokeOption) (*LookupNetworkInterfaceResult, error)
func LookupNetworkInterfaceOutput(ctx *Context, args *LookupNetworkInterfaceOutputArgs, opts ...InvokeOption) LookupNetworkInterfaceResultOutput
Copy

> Note: This function is named LookupNetworkInterface in the Go SDK.

public static class GetNetworkInterface 
{
    public static Task<GetNetworkInterfaceResult> InvokeAsync(GetNetworkInterfaceArgs args, InvokeOptions? opts = null)
    public static Output<GetNetworkInterfaceResult> Invoke(GetNetworkInterfaceInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetNetworkInterfaceResult> getNetworkInterface(GetNetworkInterfaceArgs args, InvokeOptions options)
public static Output<GetNetworkInterfaceResult> getNetworkInterface(GetNetworkInterfaceArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:ec2/getNetworkInterface:getNetworkInterface
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetNetworkInterfaceFilter>
One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out describe-network-interfaces in the AWS CLI reference.
Id string
Identifier for the network interface.
Tags Dictionary<string, string>
Any tags assigned to the network interface.
Filters []GetNetworkInterfaceFilter
One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out describe-network-interfaces in the AWS CLI reference.
Id string
Identifier for the network interface.
Tags map[string]string
Any tags assigned to the network interface.
filters List<GetNetworkInterfaceFilter>
One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out describe-network-interfaces in the AWS CLI reference.
id String
Identifier for the network interface.
tags Map<String,String>
Any tags assigned to the network interface.
filters GetNetworkInterfaceFilter[]
One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out describe-network-interfaces in the AWS CLI reference.
id string
Identifier for the network interface.
tags {[key: string]: string}
Any tags assigned to the network interface.
filters Sequence[GetNetworkInterfaceFilter]
One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out describe-network-interfaces in the AWS CLI reference.
id str
Identifier for the network interface.
tags Mapping[str, str]
Any tags assigned to the network interface.
filters List<Property Map>
One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out describe-network-interfaces in the AWS CLI reference.
id String
Identifier for the network interface.
tags Map<String>
Any tags assigned to the network interface.

getNetworkInterface Result

The following output properties are available:

Arn string
ARN of the network interface.
Associations List<GetNetworkInterfaceAssociation>
Association information for an Elastic IP address (IPv4) associated with the network interface. See supported fields below.
Attachments List<GetNetworkInterfaceAttachment>
AvailabilityZone string
Availability Zone.
Description string
Description of the network interface.
Id string
InterfaceType string
Type of interface.
Ipv6Addresses List<string>
List of IPv6 addresses to assign to the ENI.
MacAddress string
MAC address.
OutpostArn string
ARN of the Outpost.
OwnerId string
AWS account ID of the owner of the network interface.
PrivateDnsName string
Private DNS name.
PrivateIp string
Private IPv4 address of the network interface within the subnet.
PrivateIps List<string>
Private IPv4 addresses associated with the network interface.
RequesterId string
ID of the entity that launched the instance on your behalf.
SecurityGroups List<string>
List of security groups for the network interface.
SubnetId string
ID of the subnet.
Tags Dictionary<string, string>
Any tags assigned to the network interface.
VpcId string
ID of the VPC.
Filters List<GetNetworkInterfaceFilter>
Arn string
ARN of the network interface.
Associations []GetNetworkInterfaceAssociation
Association information for an Elastic IP address (IPv4) associated with the network interface. See supported fields below.
Attachments []GetNetworkInterfaceAttachmentType
AvailabilityZone string
Availability Zone.
Description string
Description of the network interface.
Id string
InterfaceType string
Type of interface.
Ipv6Addresses []string
List of IPv6 addresses to assign to the ENI.
MacAddress string
MAC address.
OutpostArn string
ARN of the Outpost.
OwnerId string
AWS account ID of the owner of the network interface.
PrivateDnsName string
Private DNS name.
PrivateIp string
Private IPv4 address of the network interface within the subnet.
PrivateIps []string
Private IPv4 addresses associated with the network interface.
RequesterId string
ID of the entity that launched the instance on your behalf.
SecurityGroups []string
List of security groups for the network interface.
SubnetId string
ID of the subnet.
Tags map[string]string
Any tags assigned to the network interface.
VpcId string
ID of the VPC.
Filters []GetNetworkInterfaceFilter
arn String
ARN of the network interface.
associations List<GetNetworkInterfaceAssociation>
Association information for an Elastic IP address (IPv4) associated with the network interface. See supported fields below.
attachments List<GetNetworkInterfaceAttachment>
availabilityZone String
Availability Zone.
description String
Description of the network interface.
id String
interfaceType String
Type of interface.
ipv6Addresses List<String>
List of IPv6 addresses to assign to the ENI.
macAddress String
MAC address.
outpostArn String
ARN of the Outpost.
ownerId String
AWS account ID of the owner of the network interface.
privateDnsName String
Private DNS name.
privateIp String
Private IPv4 address of the network interface within the subnet.
privateIps List<String>
Private IPv4 addresses associated with the network interface.
requesterId String
ID of the entity that launched the instance on your behalf.
securityGroups List<String>
List of security groups for the network interface.
subnetId String
ID of the subnet.
tags Map<String,String>
Any tags assigned to the network interface.
vpcId String
ID of the VPC.
filters List<GetNetworkInterfaceFilter>
arn string
ARN of the network interface.
associations GetNetworkInterfaceAssociation[]
Association information for an Elastic IP address (IPv4) associated with the network interface. See supported fields below.
attachments GetNetworkInterfaceAttachment[]
availabilityZone string
Availability Zone.
description string
Description of the network interface.
id string
interfaceType string
Type of interface.
ipv6Addresses string[]
List of IPv6 addresses to assign to the ENI.
macAddress string
MAC address.
outpostArn string
ARN of the Outpost.
ownerId string
AWS account ID of the owner of the network interface.
privateDnsName string
Private DNS name.
privateIp string
Private IPv4 address of the network interface within the subnet.
privateIps string[]
Private IPv4 addresses associated with the network interface.
requesterId string
ID of the entity that launched the instance on your behalf.
securityGroups string[]
List of security groups for the network interface.
subnetId string
ID of the subnet.
tags {[key: string]: string}
Any tags assigned to the network interface.
vpcId string
ID of the VPC.
filters GetNetworkInterfaceFilter[]
arn str
ARN of the network interface.
associations Sequence[GetNetworkInterfaceAssociation]
Association information for an Elastic IP address (IPv4) associated with the network interface. See supported fields below.
attachments Sequence[GetNetworkInterfaceAttachment]
availability_zone str
Availability Zone.
description str
Description of the network interface.
id str
interface_type str
Type of interface.
ipv6_addresses Sequence[str]
List of IPv6 addresses to assign to the ENI.
mac_address str
MAC address.
outpost_arn str
ARN of the Outpost.
owner_id str
AWS account ID of the owner of the network interface.
private_dns_name str
Private DNS name.
private_ip str
Private IPv4 address of the network interface within the subnet.
private_ips Sequence[str]
Private IPv4 addresses associated with the network interface.
requester_id str
ID of the entity that launched the instance on your behalf.
security_groups Sequence[str]
List of security groups for the network interface.
subnet_id str
ID of the subnet.
tags Mapping[str, str]
Any tags assigned to the network interface.
vpc_id str
ID of the VPC.
filters Sequence[GetNetworkInterfaceFilter]
arn String
ARN of the network interface.
associations List<Property Map>
Association information for an Elastic IP address (IPv4) associated with the network interface. See supported fields below.
attachments List<Property Map>
availabilityZone String
Availability Zone.
description String
Description of the network interface.
id String
interfaceType String
Type of interface.
ipv6Addresses List<String>
List of IPv6 addresses to assign to the ENI.
macAddress String
MAC address.
outpostArn String
ARN of the Outpost.
ownerId String
AWS account ID of the owner of the network interface.
privateDnsName String
Private DNS name.
privateIp String
Private IPv4 address of the network interface within the subnet.
privateIps List<String>
Private IPv4 addresses associated with the network interface.
requesterId String
ID of the entity that launched the instance on your behalf.
securityGroups List<String>
List of security groups for the network interface.
subnetId String
ID of the subnet.
tags Map<String>
Any tags assigned to the network interface.
vpcId String
ID of the VPC.
filters List<Property Map>

Supporting Types

GetNetworkInterfaceAssociation

AllocationId This property is required. string
Allocation ID.
AssociationId This property is required. string
Association ID.
CarrierIp This property is required. string
Carrier IP address associated with the network interface. This attribute is only set when the network interface is in a subnet which is associated with a Wavelength Zone.
CustomerOwnedIp This property is required. string
Customer-owned IP address.
IpOwnerId This property is required. string
ID of the Elastic IP address owner.
PublicDnsName This property is required. string
Public DNS name.
PublicIp This property is required. string
Address of the Elastic IP address bound to the network interface.
AllocationId This property is required. string
Allocation ID.
AssociationId This property is required. string
Association ID.
CarrierIp This property is required. string
Carrier IP address associated with the network interface. This attribute is only set when the network interface is in a subnet which is associated with a Wavelength Zone.
CustomerOwnedIp This property is required. string
Customer-owned IP address.
IpOwnerId This property is required. string
ID of the Elastic IP address owner.
PublicDnsName This property is required. string
Public DNS name.
PublicIp This property is required. string
Address of the Elastic IP address bound to the network interface.
allocationId This property is required. String
Allocation ID.
associationId This property is required. String
Association ID.
carrierIp This property is required. String
Carrier IP address associated with the network interface. This attribute is only set when the network interface is in a subnet which is associated with a Wavelength Zone.
customerOwnedIp This property is required. String
Customer-owned IP address.
ipOwnerId This property is required. String
ID of the Elastic IP address owner.
publicDnsName This property is required. String
Public DNS name.
publicIp This property is required. String
Address of the Elastic IP address bound to the network interface.
allocationId This property is required. string
Allocation ID.
associationId This property is required. string
Association ID.
carrierIp This property is required. string
Carrier IP address associated with the network interface. This attribute is only set when the network interface is in a subnet which is associated with a Wavelength Zone.
customerOwnedIp This property is required. string
Customer-owned IP address.
ipOwnerId This property is required. string
ID of the Elastic IP address owner.
publicDnsName This property is required. string
Public DNS name.
publicIp This property is required. string
Address of the Elastic IP address bound to the network interface.
allocation_id This property is required. str
Allocation ID.
association_id This property is required. str
Association ID.
carrier_ip This property is required. str
Carrier IP address associated with the network interface. This attribute is only set when the network interface is in a subnet which is associated with a Wavelength Zone.
customer_owned_ip This property is required. str
Customer-owned IP address.
ip_owner_id This property is required. str
ID of the Elastic IP address owner.
public_dns_name This property is required. str
Public DNS name.
public_ip This property is required. str
Address of the Elastic IP address bound to the network interface.
allocationId This property is required. String
Allocation ID.
associationId This property is required. String
Association ID.
carrierIp This property is required. String
Carrier IP address associated with the network interface. This attribute is only set when the network interface is in a subnet which is associated with a Wavelength Zone.
customerOwnedIp This property is required. String
Customer-owned IP address.
ipOwnerId This property is required. String
ID of the Elastic IP address owner.
publicDnsName This property is required. String
Public DNS name.
publicIp This property is required. String
Address of the Elastic IP address bound to the network interface.

GetNetworkInterfaceAttachment

AttachmentId This property is required. string
DeviceIndex This property is required. int
InstanceId This property is required. string
InstanceOwnerId This property is required. string
AttachmentId This property is required. string
DeviceIndex This property is required. int
InstanceId This property is required. string
InstanceOwnerId This property is required. string
attachmentId This property is required. String
deviceIndex This property is required. Integer
instanceId This property is required. String
instanceOwnerId This property is required. String
attachmentId This property is required. string
deviceIndex This property is required. number
instanceId This property is required. string
instanceOwnerId This property is required. string
attachment_id This property is required. str
device_index This property is required. int
instance_id This property is required. str
instance_owner_id This property is required. str
attachmentId This property is required. String
deviceIndex This property is required. Number
instanceId This property is required. String
instanceOwnerId This property is required. String

GetNetworkInterfaceFilter

Name This property is required. string
Values This property is required. List<string>
Name This property is required. string
Values This property is required. []string
name This property is required. String
values This property is required. List<String>
name This property is required. string
values This property is required. string[]
name This property is required. str
values This property is required. Sequence[str]
name This property is required. String
values This property is required. List<String>

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.