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.

Container for the parameters to the ModifyNetworkInterfaceAttribute operation. Modifies the specified network interface attribute. You can specify only one attribute at a time. You can use this action to attach and detach security groups from an existing EC2 instance.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.EC2.AmazonEC2Request
      Amazon.EC2.Model.ModifyNetworkInterfaceAttributeRequest

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

Syntax

C#
public class ModifyNetworkInterfaceAttributeRequest : AmazonEC2Request
         IAmazonWebServiceRequest

The ModifyNetworkInterfaceAttributeRequest type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property Attachment Amazon.EC2.Model.NetworkInterfaceAttachmentChanges

Gets and sets the property Attachment.

Information about the interface attachment. If modifying the delete on termination attribute, you must specify the ID of the interface attachment.

Public Property ConnectionTrackingSpecification Amazon.EC2.Model.ConnectionTrackingSpecificationRequest

Gets and sets the property ConnectionTrackingSpecification.

A connection tracking specification.

Public Property Description System.String

Gets and sets the property Description.

A description for the network interface.

Public Property EnablePrimaryIpv6 System.Boolean

Gets and sets the property EnablePrimaryIpv6.

If you’re modifying a network interface in a dual-stack or IPv6-only subnet, you have the option to assign a primary IPv6 IP address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if the instance that this ENI will be attached to relies on its IPv6 address not changing. Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.

Public Property EnaSrdSpecification Amazon.EC2.Model.EnaSrdSpecification

Gets and sets the property EnaSrdSpecification.

Updates the ENA Express configuration for the network interface that’s attached to the instance.

Public Property Groups System.Collections.Generic.List<System.String>

Gets and sets the property Groups.

Changes the security groups for the network interface. The new set of groups you specify replaces the current set. You must specify at least one group, even if it's just the default security group in the VPC. You must specify the ID of the security group, not the name.

Public Property NetworkInterfaceId System.String

Gets and sets the property NetworkInterfaceId.

The ID of the network interface.

Public Property SourceDestCheck System.Boolean

Gets and sets the property SourceDestCheck.

Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is true, source/destination checks are enabled; otherwise, they are disabled. The default value is true. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.

Examples

This example modifies the attachment attribute of the specified network interface.

To modify the attachment attribute of a network interface


var client = new AmazonEC2Client();
var response = client.ModifyNetworkInterfaceAttribute(new ModifyNetworkInterfaceAttributeRequest 
{
    Attachment = new NetworkInterfaceAttachmentChanges {
        AttachmentId = "eni-attach-43348162",
        DeleteOnTermination = false
    },
    NetworkInterfaceId = "eni-686ea200"
});


            

This example modifies the description attribute of the specified network interface.

To modify the description attribute of a network interface


var client = new AmazonEC2Client();
var response = client.ModifyNetworkInterfaceAttribute(new ModifyNetworkInterfaceAttributeRequest 
{
    Description = <data>,
    NetworkInterfaceId = "eni-686ea200"
});


            

This example command modifies the groupSet attribute of the specified network interface.

To modify the groupSet attribute of a network interface


var client = new AmazonEC2Client();
var response = client.ModifyNetworkInterfaceAttribute(new ModifyNetworkInterfaceAttributeRequest 
{
    Groups = new List<string> {
        "sg-903004f8",
        "sg-1a2b3c4d"
    },
    NetworkInterfaceId = "eni-686ea200"
});


            

This example command modifies the sourceDestCheck attribute of the specified network interface.

To modify the sourceDestCheck attribute of a network interface


var client = new AmazonEC2Client();
var response = client.ModifyNetworkInterfaceAttribute(new ModifyNetworkInterfaceAttributeRequest 
{
    NetworkInterfaceId = "eni-686ea200",
    SourceDestCheck = jsondata object
});


            

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

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