Modifier un attribut d’une NIC

Vous pouvez modifier un attribut d’une network interface card (NIC).

Avec Cockpit, vous pouvez seulement modifier les security groups associés à une NIC.

Avec les API, vous pouvez modifier d’autres attributs d’une NIC.

Vous ne pouvez modifier qu’un attribut à la fois.

Modifier les security groups associés à une NIC avec Cockpit v2

  1. Dans le dashboard NICs, cochez la case de la NIC dont vous voulez gérer les security groups.
    La NIC est sélectionnée.

  2. Cliquez sur IconSecurityGroup Modifier les security groups.
    La boîte de dialogue MODIFIER LES SECURITY GROUPS apparaît.

  3. Cliquez dans le champ pour faire apparaître la liste des security groups.
    Dans la liste, sélectionnez le ou les security group(s) que vous voulez associer à la NIC.

  4. Pour dissocier un security group d’une NIC, cliquez sur IconClose à côté du nom du security group.

    La NIC doit être associée à au moins un security group.

  5. Cliquez sur Modifier.
    Les security groups de la NIC sont modifiés.

Modifier un attribut d’une NIC avec OSC CLI

À ce jour, cette section est disponible en anglais uniquement.

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.

    • DeleteOnVmDeletion: (optional) If true, the NIC is deleted when the VM is terminated. If false, the NIC is detached from the VM.

    • LinkNicId: (optional) 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.

    • AccountId: The account ID of the owner of the NIC.

    • Description: The description of the NIC.

    • IsSourceDestChecked: (Net only) If true, the source/destination check is enabled. If false, it is disabled.

    • LinkNic: Information about the NIC attachment.

      • DeleteOnVmDeletion: If true, the NIC is deleted when the VM is terminated.

      • DeviceNumber: The device index for the NIC attachment (between 1 and 7, both included).

      • LinkNicId: The ID of the NIC to attach.

      • State: The state of the attachment (attaching | attached | detaching | detached).

      • VmAccountId: The account ID of the owner of the VM.

      • VmId: The ID of the VM.

    • LinkPublicIp: Information about the public IP association.

      • LinkPublicIpId: (Required in a Net) The ID representing the association of the public IP with the VM or the NIC.

      • PublicDnsName: The name of the public DNS.

      • PublicIp: The public IP associated with the NIC.

      • PublicIpAccountId: The account ID of the owner of the public IP.

      • PublicIpId: The allocation ID of the public IP.

    • MacAddress: The Media Access Control (MAC) address of the NIC.

    • NetId: The ID of the Net for the NIC.

    • NicId: The ID of the NIC.

    • PrivateDnsName: The name of the private DNS.

    • PrivateIps: The private IPs of the NIC.

      • IsPrimary: If true, the IP is the primary private IP of the NIC.

      • LinkPublicIp: Information about the public IP association.

        • LinkPublicIpId: (Required in a Net) The ID representing the association of the public IP with the VM or the NIC.

        • PublicDnsName: The name of the public DNS.

        • PublicIp: The public IP associated with the NIC.

        • PublicIpAccountId: The account ID of the owner of the public IP.

        • PublicIpId: The allocation ID of the public IP.

      • PrivateDnsName: The name of the private DNS.

      • PrivateIp: The private IP of the NIC.

    • SecurityGroups: One or more IDs of security groups for the NIC.

      • SecurityGroupId: The ID of the security group.

      • SecurityGroupName: The name of the security group.

    • State: The state of the NIC (available | attaching | in-use | detaching).

    • SubnetId: The ID of the Subnet.

    • SubregionName: The Subregion in which the NIC is located.

    • Tags: One or more tags associated with the NIC.

      • Key: The key of the tag, with a minimum of 1 character.

      • Value: The value of the tag, between 0 and 255 characters.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

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
      }
    ]
  }
}

Modifier un attribut d’une NIC avec oapi-cli

À ce jour, cette section est disponible en anglais uniquement.

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
$ oapi-cli --profile "default" UpdateNic \
    --NicId "eni-12345678" \
    --LinkNic '{
        "DeleteOnVmDeletion": False,
        "LinkNicId": "eni-attach-12345678"
      }'
Request sample: Modifying the security groups of a NIC
$ oapi-cli --profile "default" UpdateNic \
    --NicId "eni-12345678" \
    --SecurityGroupIds '["sg-12345678"]'
Request sample: Modifying the description of a NIC
$ oapi-cli --profile "default" UpdateNic \
    --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.

    • DeleteOnVmDeletion: (optional) If true, the NIC is deleted when the VM is terminated. If false, the NIC is detached from the VM.

    • LinkNicId: (optional) 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.

    • AccountId: The account ID of the owner of the NIC.

    • Description: The description of the NIC.

    • IsSourceDestChecked: (Net only) If true, the source/destination check is enabled. If false, it is disabled.

    • LinkNic: Information about the NIC attachment.

      • DeleteOnVmDeletion: If true, the NIC is deleted when the VM is terminated.

      • DeviceNumber: The device index for the NIC attachment (between 1 and 7, both included).

      • LinkNicId: The ID of the NIC to attach.

      • State: The state of the attachment (attaching | attached | detaching | detached).

      • VmAccountId: The account ID of the owner of the VM.

      • VmId: The ID of the VM.

    • LinkPublicIp: Information about the public IP association.

      • LinkPublicIpId: (Required in a Net) The ID representing the association of the public IP with the VM or the NIC.

      • PublicDnsName: The name of the public DNS.

      • PublicIp: The public IP associated with the NIC.

      • PublicIpAccountId: The account ID of the owner of the public IP.

      • PublicIpId: The allocation ID of the public IP.

    • MacAddress: The Media Access Control (MAC) address of the NIC.

    • NetId: The ID of the Net for the NIC.

    • NicId: The ID of the NIC.

    • PrivateDnsName: The name of the private DNS.

    • PrivateIps: The private IPs of the NIC.

      • IsPrimary: If true, the IP is the primary private IP of the NIC.

      • LinkPublicIp: Information about the public IP association.

        • LinkPublicIpId: (Required in a Net) The ID representing the association of the public IP with the VM or the NIC.

        • PublicDnsName: The name of the public DNS.

        • PublicIp: The public IP associated with the NIC.

        • PublicIpAccountId: The account ID of the owner of the public IP.

        • PublicIpId: The allocation ID of the public IP.

      • PrivateDnsName: The name of the private DNS.

      • PrivateIp: The private IP of the NIC.

    • SecurityGroups: One or more IDs of security groups for the NIC.

      • SecurityGroupId: The ID of the security group.

      • SecurityGroupName: The name of the security group.

    • State: The state of the NIC (available | attaching | in-use | detaching).

    • SubnetId: The ID of the Subnet.

    • SubregionName: The Subregion in which the NIC is located.

    • Tags: One or more tags associated with the NIC.

      • Key: The key of the tag, with a minimum of 1 character.

      • Value: The value of the tag, between 0 and 255 characters.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

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
      }
    ]
  }
}

Modifier un attribut d’une FNI avec AWS CLI

Avant de commencer : Installez et configurez AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI.

Pour modifier un attribut d’une FNI, utilisez la commande modify-network-interface-attribute en suivant cette syntaxe :

Exemple de requête
$ 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

Cette commande contient les attributs suivants que vous devez spécifier :

  • (optionnel) profile : Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI.

  • network-interface-id : L’ID de la FNI.

  • (optionnel) description : Une nouvelle description pour la FNI.

  • (optionnel) groups : Un ou plusieurs ID de security groups à associer à la FNI.

    La FNI doit être associée à au moins un security group.

  • (optionnel) attachment : Une nouvelle configuration pour l’attachement. Cet attribut contient les éléments suivants que vous devez spécifier :

    • AttachmentId : L’ID de l’attachement de la FNI. Pour en savoir plus sur la façon de le retrouver, voir Obtenir des informations sur vos NIC.

    • DeleteOnTermination : Par défaut ou si paramétré sur false, la FNI est détachée de l’instance quand l’instance est terminée. Si true, la FNI est supprimée.

  • endpoint : Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.

L’attribut spécifié de la FNI est modifié.

Pages connexes

Méthodes API correspondantes

AWS™ et Amazon Web Services™ sont des marques de commerce d'Amazon Technologies, Inc. ou de ses affiliées aux États-Unis et/ou dans les autres pays.