ALIYUN::ECS::NetworkInterface is used to create an elastic network interface (ENI).
Syntax
{
"Type": "ALIYUN::ECS::NetworkInterface",
"Properties": {
"Description": String,
"SecurityGroupId": String,
"PrimaryIpAddress": String,
"ResourceGroupId": String,
"VSwitchId": String,
"NetworkInterfaceName": String,
"Tags": List,
"SecurityGroupIds": List,
"PrivateIpAddresses": List,
"SecondaryPrivateIpAddressCount": Integer,
"Ipv6Addresses": List,
"QueueNumber": Integer,
"NetworkInterfaceTrafficMode": String,
"Ipv6AddressCount": Integer,
"Ipv6Prefixes": List,
"Ipv4Prefixes": List,
"Ipv4PrefixCount": Integer,
"TxQueueSize": Integer,
"DeleteOnRelease": Boolean,
"Ipv6PrefixCount": Integer,
"RxQueueSize": Integer
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
ResourceGroupId | String | No | Yes | The ID of the resource group. | You can call the ListResourceGroups operation to query the resource group ID. |
SecurityGroupId | String | No | Yes | The ID of the security group. | The security group and the ENI must belong to the same virtual private cloud (VPC). Note You cannot specify both SecurityGroupId and SecurityGroupIds. |
VSwitchId | String | Yes | No | The vSwitch ID. | None. |
Description | String | No | Yes | The description of the ENI. | The description must be 2 to 256 characters in length, and cannot start with |
NetworkInterfaceName | String | No | Yes | The ENI name. | The name must be 2 to 128 characters in length. It must start with a letter and cannot start with |
PrimaryIpAddress | String | No | No | The primary private IP address of the ENI. | The primary private IP address must be an idle IP address within the CIDR block of the vSwitch with which you want to associate the ENI. If you leave this property empty, an idle IP address is assigned from the vSwitch CIDR block at random. |
SecondaryPrivateIpAddressCount | Integer | No | No | The number of secondary private IP addresses. | None. |
Tags | List | No | Yes | The tags. | You can add up to 20 tags. For more information, see Tags properties. |
SecurityGroupIds | List | No | Yes | The IDs of one or more security groups. | The security groups and the ENI must belong to the same VPC. Note You cannot specify both SecurityGroupId and SecurityGroupIds. |
PrivateIpAddresses | List | No | No | The one or more secondary private IP addresses to assign to the ENI from the CIDR block of the vSwitch with which you want to associate the ENI. | Valid values of the number of secondary private IP addresses that can be assigned to the ENI:
|
Ipv6Addresses | List | No | No | The one or more IPv6 addresses to assign to the ENI. | You can specify up to 10 IPv6 addresses. Note If you want to assign IPv6 addresses to the ENI, you must specify the |
QueueNumber | Integer | No | No | The number of queues supported by the ENI. | Valid values: 1 to 2048. When you attach the ENI to an instance, make sure that the value of this property is less than the maximum number of queues per ENI allowed for the instance type. To query the maximum number of queues per ENI for the instance type, call the DescribeInstanceTypes operation and check the return value of The QueueNumber property is left empty by default. If you leave this property empty when you attach the ENI to an instance, the default number of queues per ENI allowed for the instance type is used. To query the default number of queues per ENI for the instance type, call the DescribeInstanceTypes operation and check the return value of |
NetworkInterfaceTrafficMode | String | No | No | The communication mode of the ENI. | Valid values:
|
Ipv6AddressCount | Integer | No | No | The number of IPv6 addresses to generate for the ENI at random. | Valid values: 1 to 10. Note If you want to assign IPv6 addresses to the ENI, you must specify the |
Ipv6Prefixes | List | No | No | The IPv6 prefixes. | None. |
Ipv4Prefixes | List | No | No | The IPv4 prefixes. | None. |
Ipv4PrefixCount | Integer | No | No | The number of IPv4 prefixes to assign to the ENI. | Valid values: 1 to 10. Note If you want to assign IPv4 prefixes to the ENI, you must specify the Ipv4Prefixes or Ipv4PrefixCount property, but not both the properties. |
TxQueueSize | Integer | No | Yes | The transmit (Tx) queue depth of the ENI. | Take note of the following items:
|
DeleteOnRelease | Boolean | No | Yes | Specifies whether to retain the ENI when the associated instance is released. | Valid values:
|
Ipv6PrefixCount | Integer | No | No | The number of IPv6 prefixes to assign to the ENI. | Valid values: 1 to 10. Note If you want to assign IPv6 prefixes to the ENI, you must specify the Ipv6Prefixes or Ipv6PrefixCount property, but not both the properties. |
RxQueueSize | Integer | No | Yes | The Rx queue depth of the ENI. | Take note of the following items:
|
Tags syntax
"Tags": [
{
"Key": String,
"Value": String
}
]
Tags properties
Property | Type | Required | Editable | Description | Constraint |
Key | String | Yes | No | The tag key. | The tag key must be 1 to 128 characters in length, and cannot contain |
Value | String | No | No | The tag value. | The tag value can be up to 128 characters in length, and cannot contain |
Return values
Fn::GetAtt
NetworkInterfaceId: the ENI ID.
MacAddress: the media access control (MAC) address of the ENI.
PrivateIpAddress: the private IP address of the ENI.
SecondaryPrivateIpAddresses: the secondary private IP addresses of the ENI.
Examples
YAML
format
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
SecurityGroupId:
Type: String
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
Label:
en: Security Group ID
VSwitchId:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
Type: String
Label:
en: VSwitch ID
Resources:
EniInstance:
Type: ALIYUN::ECS::NetworkInterface
Properties:
SecurityGroupId:
Ref: SecurityGroupId
VSwitchId:
Ref: VSwitchId
NetworkInterfaceName: TestNetworkInterface
Outputs:
PrivateIpAddress:
Description: The primary private ip address of your Network Interface.
Value:
Fn::GetAtt:
- EniInstance
- PrivateIpAddress
SecondaryPrivateIpAddresses:
Description: The secondary private IP addresses of your Network Interface.
Value:
Fn::GetAtt:
- EniInstance
- SecondaryPrivateIpAddresses
MacAddress:
Description: The MAC address of your Network Interface.
Value:
Fn::GetAtt:
- EniInstance
- MacAddress
NetworkInterfaceId:
Description: ID of your Network Interface.
Value:
Fn::GetAtt:
- EniInstance
- NetworkInterfaceId
JSON
format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"SecurityGroupId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
"Label": {
"en": "Security Group ID"
}
},
"VSwitchId": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"Type": "String",
"Label": {
"en": "VSwitch ID"
}
}
},
"Resources": {
"EniInstance": {
"Type": "ALIYUN::ECS::NetworkInterface",
"Properties": {
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"NetworkInterfaceName": "TestNetworkInterface"
}
}
},
"Outputs": {
"PrivateIpAddress": {
"Description": "The primary private ip address of your Network Interface.",
"Value": {
"Fn::GetAtt": [
"EniInstance",
"PrivateIpAddress"
]
}
},
"SecondaryPrivateIpAddresses": {
"Description": "The secondary private IP addresses of your Network Interface.",
"Value": {
"Fn::GetAtt": [
"EniInstance",
"SecondaryPrivateIpAddresses"
]
}
},
"MacAddress": {
"Description": "The MAC address of your Network Interface.",
"Value": {
"Fn::GetAtt": [
"EniInstance",
"MacAddress"
]
}
},
"NetworkInterfaceId": {
"Description": "ID of your Network Interface.",
"Value": {
"Fn::GetAtt": [
"EniInstance",
"NetworkInterfaceId"
]
}
}
}
}