Creating a NIC

You can create a network interface card (NIC) in the Subnet of a Net (VPC ).

You can then attach the NIC to a virtual machine (VM) located in the same Subnet, if the VM is in the same Subregion. For more information, see Attaching a NIC to a VM.

You also need to associate security groups with appropriate rules with your NICs to allow access to and from them. For more information, see About Security Groups.

Creating a NIC Using Cockpit v2

  1. In the NICs dashboard, click IconAddFull Create NIC.
    The CREATE NIC dialog box appears.

  2. In the Name field, type a name for the NIC.

    This action adds a Name tag of 255 characters maximum. You can use any character, including accented letters.

  3. (optional) In the Description field, type a description for the NIC.

    This description can contain up to 255 Unicode characters.

  4. From the Subnet list, select the Subnet in which you want to create the NIC.

  5. (optional) In the Private IP field, type the primary private IP for the NIC.

    • This IP must be within the IP range of the Subnet that you specified in the previous step.

    • If you do not specify this field, a private IP belonging to the CIDR of the Subnet is randomly assigned by the DHCP server of the Net.

  6. From the Security Group list, select:

    • Create a new security group to assign a new security group to the NIC.

      1. In the Name field, type a name for the security group.

      2. In the Description field, type its description.

        • The name must be unique in your account for the public Cloud or for each Net.

        • The name of the security group must not start with sg-.

        • Each name and description can contain between 1 and 255 characters. Allowed characters are a-z, A-Z, 0-9, spaces, and _.-:/()#,@[]+=&;\{}!$*.

    • Select one or more existing security groups to select one or more security groups for the NIC.

    • Proceed with a default security group to select the default security group of the Net.

  7. Click Create.
    The NIC is created.

Creating a NIC Using OSC CLI

The CreateNic command creates a network interface card (NIC) in the specified Subnet.

For more information, see About NICs.

Request sample: Creating a NIC
$ osc-cli api CreateNic --profile "default" \
    --SubnetId "subnet-12345678" \
    --SecurityGroupIds '["sg-12345678"]'
Request sample: Creating a NIC with specific private IPs
$ osc-cli api CreateNic --profile "default" \
    --Description "Terraform nic with private IPs" \
    --SubnetId "subnet-12345678" \
    --SecurityGroupIds '["sg-12345678"]' \
    --PrivateIps '[
        {
          "IsPrimary": True,
          "PrivateIp": "10.0.0.4",
        },
        {
          "IsPrimary": False,
          "PrivateIp": "10.0.0.5",
        },
      ]'

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

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

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

  • PrivateIps: (optional) The primary private IP for the NIC.
    This IP must be within the IP range of the Subnet that you specify with the SubnetId attribute.
    If you do not specify this attribute, a random private IP is selected within the IP range of the Subnet.

  • SecurityGroupIds: (optional) One or more IDs of security groups for the NIC.

  • SubnetId: The ID of the Subnet in which you want to create the NIC.

The CreateNic command returns the following elements:

  • Nic: Information about the NIC.

  • ResponseContext: Information about the context of the response.

Result sample: Creating a NIC
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Nic": {
    "SubregionName": "eu-west-2a",
    "SubnetId": "subnet-12345678",
    "State": "available",
    "IsSourceDestChecked": true,
    "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
    "Tags": [],
    "Description": "",
    "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: Creating a NIC with specific private IPs
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Nic": {
    "SubregionName": "eu-west-2a",
    "SubnetId": "subnet-12345678",
    "State": "available",
    "IsSourceDestChecked": true,
    "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
    "Tags": [],
    "Description": "",
    "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
      },
      {
        "PrivateDnsName": "ip-10-0-0-5.eu-west-2.compute.internal",
        "PrivateIp": "10.0.0.5",
        "IsPrimary": false
      }
    ]
  }
}

Creating an FNI Using AWS CLI

To create an FNI, use the create-network-interface command following this syntax:

Request sample
$ aws ec2 create-network-interface \
  --profile YOUR_PROFILE \
  --subnet-id subnet-12345678 \
  --description my-FNI \
  --private-ip-address 10.0.0.4 \
  --groups sg-12345678 \
  --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.

  • subnet-id: The ID of the subnet in which you want to create the FNI.

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

    This description can contain any Unicode character, with no length limit.

  • (optional) private-ip-address: The primary private IP for the FNI.

    • This IP must be within the IP range of the subnet that you specified with the subnet-id attribute.

    • If you do not specify this attribute, a random private IP is selected within the IP range of the subnet.

  • (optional) groups: One or more IDs of security groups for the FNI.

    If you do not specify any security group, the default security group of the VPC is associated.

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

The create-network-interface command returns the following elements:

  • NetworkInterface: Information about the newly created FNI. This element contains the following information:

    • AvailabilityZone: The AZ where the FNI is. For more information, see Regions, Endpoints and Subregions Reference.

    • Description: The description of the FNI.

    • Groups: Information about one or more security groups associated with the FNI. This element contains the following information:

      • GroupName: The name of the security group.

      • GroupId: The ID of the security group.

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

    • NetworkInterfaceId: The ID of the FNI.

    • OwnerId: The account ID of the owner of the FNI.

    • PrivateDnsName: The private DNS name associated with the primary private IP.

    • PrivateIpAddress: The primary private IP of the FNI.

    • PrivateIpAddresses: Information about the primary and secondary private IPs of the FNI. This element contains the following information:

      • Primary: If true, the private IP is the primary one. If false, it is a secondary private IP.

      • PrivateDnsName: The private DNS name associated with the private IP.

      • PrivateIpAddress: The private IP.

    • SourceDestCheck: If true, the traffic to or from the instance is validated. If false, it is not.

    • Status: The state of the FNI. For more information, see About FNIs > FNIs Attachment to Instances.

    • SubnetId: The ID of the subnet where the FNI is located.

    • TagSet: One or more tags associated with the FNI.

    • VpcId: The ID of the VPC where the FNI is located.

Result sample
 {
    "NetworkInterface": {
    "AvailabilityZone": "eu-west-2a",
        "Description": "my-FNI",
        "Groups": [
            {
                "GroupName": "SG1",
                "GroupId": "sg-12345678"
            }
        ],
        "MacAddress": "02:1A:80:41:52:9C",
        "NetworkInterfaceId": "eni-12345678",
        "OwnerId": "123456789000",
        "PrivateDnsName"; "ip-10-0-0-4.eu-west-2.compute.internal",
        "PrivateIpAddress": "10.0.0.4",
        "PrivateIpAddresses": [
            {
        "Primary": true,
                "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
                "PrivateIpAddress": "10.0.0.4"
            }
        ],
        "SourceDestCheck": true,
        "Status": "available",
        "SubnetId": "subnet-12345678",
        "TagSet": [],
    "VpcId": "vpc-87654321"
    }
}

The FNI is created.

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.