AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Creates a network interface in the specified subnet.

The number of IP addresses you can assign to a network interface varies by instance type. For more information, see IP Addresses Per ENI Per Instance Type in the Amazon Virtual Private Cloud User Guide.

For more information about network interfaces, see Elastic network interfaces in the Amazon Elastic Compute Cloud User Guide.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to CreateNetworkInterfaceAsync.

Namespace: Amazon.EC2
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public virtual CreateNetworkInterfaceResponse CreateNetworkInterface(
         CreateNetworkInterfaceRequest request
)

Parameters

request
Type: Amazon.EC2.Model.CreateNetworkInterfaceRequest

Container for the necessary parameters to execute the CreateNetworkInterface service method.

Return Value


The response from the CreateNetworkInterface service method, as returned by EC2.

Examples

This example creates a network interface for the specified subnet.

To create a network interface


var client = new AmazonEC2Client();
var response = client.CreateNetworkInterface(new CreateNetworkInterfaceRequest 
{
    Description = "my network interface",
    Groups = new List<string> {
        "sg-903004f8"
    },
    PrivateIpAddress = "10.0.2.17",
    SubnetId = "subnet-9d4a7b6c"
});

NetworkInterface networkInterface = response.NetworkInterface;

            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

See Also