AWS v7.10.0 published on Friday, Oct 24, 2025 by Pulumi
aws.ec2.getNetworkInterfaces
Example Usage
The following shows outputting all network interface ids in a region.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
export = async () => {
    const example = await aws.ec2.getNetworkInterfaces({});
    return {
        example: example.ids,
    };
}
import pulumi
import pulumi_aws as aws
example = aws.ec2.get_network_interfaces()
pulumi.export("example", example.ids)
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := ec2.GetNetworkInterfaces(ctx, &ec2.GetNetworkInterfacesArgs{}, nil)
		if err != nil {
			return err
		}
		ctx.Export("example", example.Ids)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2.GetNetworkInterfaces.Invoke();
    return new Dictionary<string, object?>
    {
        ["example"] = example.Apply(getNetworkInterfacesResult => getNetworkInterfacesResult.Ids),
    };
});
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.GetNetworkInterfacesArgs;
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 example = Ec2Functions.getNetworkInterfaces(GetNetworkInterfacesArgs.builder()
            .build());
        ctx.export("example", example.ids());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:ec2:getNetworkInterfaces
      arguments: {}
outputs:
  example: ${example.ids}
The following example retrieves a list of all network interface ids with a custom tag of Name set to a value of test.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2.getNetworkInterfaces({
    tags: {
        Name: "test",
    },
});
export const example1 = example.then(example => example.ids);
import pulumi
import pulumi_aws as aws
example = aws.ec2.get_network_interfaces(tags={
    "Name": "test",
})
pulumi.export("example1", example.ids)
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := ec2.GetNetworkInterfaces(ctx, &ec2.GetNetworkInterfacesArgs{
			Tags: map[string]interface{}{
				"Name": "test",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("example1", example.Ids)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2.GetNetworkInterfaces.Invoke(new()
    {
        Tags = 
        {
            { "Name", "test" },
        },
    });
    return new Dictionary<string, object?>
    {
        ["example1"] = example.Apply(getNetworkInterfacesResult => getNetworkInterfacesResult.Ids),
    };
});
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.GetNetworkInterfacesArgs;
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 example = Ec2Functions.getNetworkInterfaces(GetNetworkInterfacesArgs.builder()
            .tags(Map.of("Name", "test"))
            .build());
        ctx.export("example1", example.ids());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:ec2:getNetworkInterfaces
      arguments:
        tags:
          Name: test
outputs:
  example1: ${example.ids}
The following example retrieves a network interface ids which associated with specific subnet.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
export = async () => {
    const example = await aws.ec2.getNetworkInterfaces({
        filters: [{
            name: "subnet-id",
            values: [test.id],
        }],
    });
    return {
        example: example.ids,
    };
}
import pulumi
import pulumi_aws as aws
example = aws.ec2.get_network_interfaces(filters=[{
    "name": "subnet-id",
    "values": [test["id"]],
}])
pulumi.export("example", example.ids)
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := ec2.GetNetworkInterfaces(ctx, &ec2.GetNetworkInterfacesArgs{
Filters: []ec2.GetNetworkInterfacesFilter{
{
Name: "subnet-id",
Values: interface{}{
test.Id,
},
},
},
}, nil);
if err != nil {
return err
}
ctx.Export("example", example.Ids)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2.GetNetworkInterfaces.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2.Inputs.GetNetworkInterfacesFilterInputArgs
            {
                Name = "subnet-id",
                Values = new[]
                {
                    test.Id,
                },
            },
        },
    });
    return new Dictionary<string, object?>
    {
        ["example"] = example.Apply(getNetworkInterfacesResult => getNetworkInterfacesResult.Ids),
    };
});
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.GetNetworkInterfacesArgs;
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 example = Ec2Functions.getNetworkInterfaces(GetNetworkInterfacesArgs.builder()
            .filters(GetNetworkInterfacesFilterArgs.builder()
                .name("subnet-id")
                .values(test.id())
                .build())
            .build());
        ctx.export("example", example.ids());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:ec2:getNetworkInterfaces
      arguments:
        filters:
          - name: subnet-id
            values:
              - ${test.id}
outputs:
  example: ${example.ids}
Using getNetworkInterfaces
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 getNetworkInterfaces(args: GetNetworkInterfacesArgs, opts?: InvokeOptions): Promise<GetNetworkInterfacesResult>
function getNetworkInterfacesOutput(args: GetNetworkInterfacesOutputArgs, opts?: InvokeOptions): Output<GetNetworkInterfacesResult>def get_network_interfaces(filters: Optional[Sequence[GetNetworkInterfacesFilter]] = None,
                           region: Optional[str] = None,
                           tags: Optional[Mapping[str, str]] = None,
                           opts: Optional[InvokeOptions] = None) -> GetNetworkInterfacesResult
def get_network_interfaces_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetNetworkInterfacesFilterArgs]]]] = None,
                           region: Optional[pulumi.Input[str]] = None,
                           tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetNetworkInterfacesResult]func GetNetworkInterfaces(ctx *Context, args *GetNetworkInterfacesArgs, opts ...InvokeOption) (*GetNetworkInterfacesResult, error)
func GetNetworkInterfacesOutput(ctx *Context, args *GetNetworkInterfacesOutputArgs, opts ...InvokeOption) GetNetworkInterfacesResultOutput> Note: This function is named GetNetworkInterfaces in the Go SDK.
public static class GetNetworkInterfaces 
{
    public static Task<GetNetworkInterfacesResult> InvokeAsync(GetNetworkInterfacesArgs args, InvokeOptions? opts = null)
    public static Output<GetNetworkInterfacesResult> Invoke(GetNetworkInterfacesInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetNetworkInterfacesResult> getNetworkInterfaces(GetNetworkInterfacesArgs args, InvokeOptions options)
public static Output<GetNetworkInterfacesResult> getNetworkInterfaces(GetNetworkInterfacesArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ec2/getNetworkInterfaces:getNetworkInterfaces
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<GetNetwork Interfaces Filter> 
- Custom filter block as described below.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Dictionary<string, string>
- Map of tags, each pair of which must exactly match a pair on the desired network interfaces.
- Filters
[]GetNetwork Interfaces Filter 
- Custom filter block as described below.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- map[string]string
- Map of tags, each pair of which must exactly match a pair on the desired network interfaces.
- filters
List<GetNetwork Interfaces Filter> 
- Custom filter block as described below.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Map<String,String>
- Map of tags, each pair of which must exactly match a pair on the desired network interfaces.
- filters
GetNetwork Interfaces Filter[] 
- Custom filter block as described below.
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- {[key: string]: string}
- Map of tags, each pair of which must exactly match a pair on the desired network interfaces.
- filters
Sequence[GetNetwork Interfaces Filter] 
- Custom filter block as described below.
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Mapping[str, str]
- Map of tags, each pair of which must exactly match a pair on the desired network interfaces.
- filters List<Property Map>
- Custom filter block as described below.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Map<String>
- Map of tags, each pair of which must exactly match a pair on the desired network interfaces.
getNetworkInterfaces Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- List of all the network interface ids found.
- Region string
- Dictionary<string, string>
- Filters
List<GetNetwork Interfaces Filter> 
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- List of all the network interface ids found.
- Region string
- map[string]string
- Filters
[]GetNetwork Interfaces Filter 
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- List of all the network interface ids found.
- region String
- Map<String,String>
- filters
List<GetNetwork Interfaces Filter> 
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- List of all the network interface ids found.
- region string
- {[key: string]: string}
- filters
GetNetwork Interfaces Filter[] 
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- List of all the network interface ids found.
- region str
- Mapping[str, str]
- filters
Sequence[GetNetwork Interfaces Filter] 
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- List of all the network interface ids found.
- region String
- Map<String>
- filters List<Property Map>
Supporting Types
GetNetworkInterfacesFilter   
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values List<string>
- Set of values that are accepted for the given field.
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values []string
- Set of values that are accepted for the given field.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- Set of values that are accepted for the given field.
- name string
- Name of the field to filter by, as defined by the underlying AWS API.
- values string[]
- Set of values that are accepted for the given field.
- name str
- Name of the field to filter by, as defined by the underlying AWS API.
- values Sequence[str]
- Set of values that are accepted for the given field.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- Set of values that are accepted for the given field.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.
