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
-
In the NICs dashboard, click
Create NIC.
The CREATE NIC dialog box appears. -
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.
-
(optional) In the Description field, type a description for the NIC.
This description can contain up to 255 Unicode characters.
-
From the Subnet list, select the Subnet in which you want to create the NIC.
-
(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.
-
-
From the Security Group list, select:
-
Create a new security group to assign a new security group to the NIC.
-
In the Name field, type a name for the security group.
-
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.
-
-
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.
$ osc-cli api CreateNic --profile "default" \
--SubnetId "subnet-12345678" \
--SecurityGroupIds '["sg-12345678"]'
$ 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 theSubnetIdattribute.
If you do not specify this attribute, a random private IP is selected within the IP range of the Subnet.-
IsPrimary: (optional) If true, the IP is the primary private IP of the NIC. -
PrivateIp: (optional) The private IP of the NIC.
-
-
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.-
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 (between1and7, 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.
-
{
"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
}
]
}
}
{
"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 a NIC Using oapi-cli
The CreateNic command creates a network interface card (NIC) in the specified Subnet.
For more information, see About NICs.
$ oapi-cli --profile "default" CreateNic \
--SubnetId "subnet-12345678" \
--SecurityGroupIds '["sg-12345678"]'
$ oapi-cli --profile "default" CreateNic \
--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 theSubnetIdattribute.
If you do not specify this attribute, a random private IP is selected within the IP range of the Subnet.-
IsPrimary: (optional) If true, the IP is the primary private IP of the NIC. -
PrivateIp: (optional) The private IP of the NIC.
-
-
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.-
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 (between1and7, 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.
-
{
"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
}
]
}
}
{
"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
Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI. |
To create an FNI, use the create-network-interface command following this syntax:
$ 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 options 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-idoption. -
If you do not specify this option, 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. For more information, see Installing and Configuring AWS CLI.
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 About Regions and Subregions. -
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: Iftrue, the private IP is the primary one. Iffalse, it is a secondary private IP. -
PrivateDnsName: The private DNS name associated with the private IP. -
PrivateIpAddress: The private IP.
-
-
SourceDestCheck: Iftrue, the traffic to or from the instance is validated. Iffalse, it is not. -
Status: The state of the FNI. For more information, see About NICs > NICs Attachment to VMs. -
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.
-
{
"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.