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. Cliquez dans le dashboard NICs pour faire apparaître des cases à cocher.

  2. Cochez la case de la NIC dont vous voulez gérer les security groups.
    La NIC est sélectionnée et un menu d’actions apparaît.

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

  4. 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.

  5. 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.

  6. 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.

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

Modifier un attribut d’une FNI avec 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.

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.