Modifying a NIC Attribute

You can modify an attribute of a network interface card (NIC).

Using Cockpit, you can only modify the security groups associated with a NIC.

Using the APIs, you can modify other attributes of a NIC.

You can specify only one attribute at a time.

Modifying the Security Groups Associated with a NIC Using Cockpit v2

  1. Click inside the NICs dashboard to make checkboxes appear.

  2. Check the box of the NIC you want to manage the security groups for.
    The NIC is selected and an action menu appears.

  3. Click IconSecurityGroup Update Security Groups.
    The UPDATE SECURITY GROUPS dialog box appears.

  4. Click in the field to make the list of security groups appear.
    From the list, select the security group(s) you want to associate with the NIC.

  5. To disassociate a security group from the NIC, click IconClose next to the name of the security group.

    The NIC must be associated with at least one security group.

  6. Click Update.
    The security groups of the NIC are modified.

Modifying a NIC Attribute Using OSC CLI

The UpdateNic command modifies the specified network interface card (NIC). You can specify only one attribute at a time.

Request sample: Modifying the DeleteOnVmDeletion value of a NIC
$ osc-cli api UpdateNic --profile "default" \
    --NicId "eni-12345678" \
    --LinkNic '{
        "DeleteOnVmDeletion": False,
        "LinkNicId": "eni-attach-12345678",
      }'
Request sample: Modifying the security groups of a NIC
$ osc-cli api UpdateNic --profile "default" \
    --NicId "eni-12345678" \
    --SecurityGroupIds '["sg-12345678"]'
Request sample: Modifying the description of a NIC
$ osc-cli api UpdateNic --profile "default" \
    --NicId "eni-12345678" \
    --Description "Example of description"

This command contains the following attributes that you need to specify:

  • Description: (optional) A new description for the NIC.

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • LinkNic: (optional) Information about the NIC attachment. If you are modifying the DeleteOnVmDeletion attribute, you must specify the ID of the NIC attachment.

  • NicId: The ID of the NIC you want to modify.

  • SecurityGroupIds: (optional) One or more IDs of security groups for the NIC.
    You must specify at least one group, even if you use the default security group in the Net.

The UpdateNic command returns the following elements:

  • Nic: Information about the NIC.

  • ResponseContext: Information about the context of the response.

Result sample: Modifying the DeleteOnVmDeletion value of a NIC
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Nic": {
    "SubregionName": "eu-west-2a",
    "SubnetId": "subnet-12345678",
    "State": "in-use",
    "LinkNic": {
      "VmId": "i-12345678",
      "LinkNicId": "eni-attach-12345678",
      "VmAccountId": "123456789012",
      "DeleteOnVmDeletion": false,
      "DeviceNumber": 0,
      "State": "attached"
    },
    "IsSourceDestChecked": true,
    "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
    "Tags": [],
    "Description": "Primary network interface",
    "AccountId": "123456789012",
    "SecurityGroups": [
      {
        "SecurityGroupName": "default",
        "SecurityGroupId": "sg-12345678"
      }
    ],
    "MacAddress": "A1:B2:C3:D4:E5:F6",
    "NetId": "vpc-12345678",
    "NicId": "eni-12345678",
    "PrivateIps": [
      {
        "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
        "PrivateIp": "10.0.0.4",
        "IsPrimary": true
      }
    ]
  }
}
Result sample: Modifying the security groups of a NIC
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Nic": {
    "SubregionName": "eu-west-2a",
    "SubnetId": "subnet-12345678",
    "State": "in-use",
    "LinkNic": {
      "VmId": "i-12345678",
      "LinkNicId": "eni-attach-12345678",
      "VmAccountId": "123456789012",
      "DeleteOnVmDeletion": true,
      "DeviceNumber": 0,
      "State": "attached"
    },
    "IsSourceDestChecked": true,
    "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
    "Tags": [],
    "Description": "Primary network interface",
    "AccountId": "123456789012",
    "SecurityGroups": [
      {
        "SecurityGroupName": "security-group-example",
        "SecurityGroupId": "sg-12345678"
      }
    ],
    "MacAddress": "A1:B2:C3:D4:E5:F6",
    "NetId": "vpc-12345678",
    "NicId": "eni-12345678",
    "PrivateIps": [
      {
        "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
        "PrivateIp": "10.0.0.4",
        "IsPrimary": true
      }
    ]
  }
}
Result sample: Modifying the description of a NIC
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Nic": {
    "SubregionName": "eu-west-2a",
    "SubnetId": "subnet-12345678",
    "State": "in-use",
    "LinkNic": {
      "VmId": "i-12345678",
      "LinkNicId": "eni-attach-12345678",
      "VmAccountId": "123456789012",
      "DeleteOnVmDeletion": true,
      "DeviceNumber": 0,
      "State": "attached"
    },
    "IsSourceDestChecked": true,
    "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
    "Tags": [],
    "Description": "Example of description",
    "AccountId": "123456789012",
    "SecurityGroups": [
      {
        "SecurityGroupName": "default",
        "SecurityGroupId": "sg-12345678"
      }
    ],
    "MacAddress": "A1:B2:C3:D4:E5:F6",
    "NetId": "vpc-12345678",
    "NicId": "eni-12345678",
    "PrivateIps": [
      {
        "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
        "PrivateIp": "10.0.0.4",
        "IsPrimary": true
      }
    ]
  }
}

Modifying an FNI Attribute Using AWS CLI

To modify an attribute of the network interface, use the modify-network-interface-attribute command following this syntax:

Request sample
$ aws ec2 modify-network-interface-attribute \
  --profile YOUR_PROFILE \
  --network-interface-id eni-12345678 \
  [--description NOT_SPECIFIED] \
  [--groups NOT_SPECIFIED] \
  --attachment "AttachmentId=eni-attach-12345678,DeleteOnTermination=false" \
  --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • network-interface-id: The ID of the FNI.

  • (optional) description: A new description for the FNI.

  • (optional) groups: One or more IDs of security groups to associate with the FNI.

    The FNI must be associated with at least one security group.

  • (optional) attachment: A new configuration for the attachment. This attribute contains the following elements that you need to specify:

    • AttachmentId: The ID of the FNI attachment. For more information about how to retrieve it, see Getting Information About Your NICs.

    • DeleteOnTermination: By default or if set to false, the FNI is detached from the instance when the instance is terminated. If true, the FNI is deleted.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The specified attribute of the FNI is modified.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.