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
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
ResourceGroupId | String | No | Yes | The ID of the resource group to which the ENI belongs. | .You can call the ListResourceGroups operation to query the resource group ID. |
SecurityGroupId | String | No | Yes | The ID of the security group to which the ENI belongs. | The security groups and the ENI must belong to the same VPC.
Note You cannot configure the SecurityGroupId and SecurityGroupIds properties at the same
time.
|
VSwitchId | String | Yes | No | The vSwitch ID of the ENI. | None |
Description | String | No | Yes | The description of the ENI. | The description must be 2 to 256 characters in length and cannot start with http:// or https:// .
|
NetworkInterfaceName | String | No | Yes | The name of the ENI. | The name must be 2 to 128 characters in length and can contain letters, digits, colons(:),
underscores (_), and hyphens (-). The name must start with a letter but cannot start
with http:// or https:// .
|
PrimaryIpAddress | String | No | No | The primary private IP address of the ENI. | The specified IP address must be an idle IP address within the CIDR block of the vSwitch. If this property is not specified, 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 of the ENI. | 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 to which the ENI belongs. | The security groups and the ENI must belong to the same VPC.
Note You cannot configure the SecurityGroupId and SecurityGroupIds properties at the same
time.
|
PrivateIpAddresses | List | No | No | The secondary private IP addresses selected from the CIDR block of the vSwitch that hosts the ENI. |
|
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 http:// or https:// . The tag key cannot start with acs: or aliyun .
|
Value | String | No | No | The tag value. | The tag value must be 0 to 128 characters in length and cannot contain http:// or https:// . The tag value cannot start with acs: or aliyun .
|
Return values
Fn::GetAtt
- NetworkInterfaceId: the ID of the ENI.
- MacAddress: the MAC address of the ENI.
- PrivateIpAddresses: the private IP addresses assigned to the ENI.
- SecondaryPrivateIpAddresses: the secondary private IP addresses assigned to the ENI.
Examples
JSON
format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"Description": {
"Type": "String",
"Description": "Description of your ENI. It is a string of [2, 256] English or Chinese characters."
},
"PrivateIpAddresses": {
"Type": "Json",
"Description": "Specifies secondary private IP addresses of the ENI. This IP address must be an available IP address in the CIDR block of the VSwitch to which the ENI belongs.",
"MaxLength": 10
},
"ResourceGroupId": {
"Type": "String",
"Description": "Resource group id."
},
"SecondaryPrivateIpAddressCount": {
"Type": "Number",
"Description": "The number of private IP addresses that can be created automatically by ECS."
},
"SecurityGroupId": {
"Type": "String",
"Description": "The ID of the security group that the ENI joins. The security group and the ENI must be in a same VPC."
},
"VSwitchId": {
"Type": "String",
"Description": "VSwitch ID of the specified VPC. Specifies the switch ID for the VPC."
},
"NetworkInterfaceName": {
"Type": "String",
"Description": "Name of your ENI. It is a string of [2, 128] Chinese or English characters. It must begin with a letter and can contain numbers, underscores (_), colons (:), or hyphens (-)."
},
"PrimaryIpAddress": {
"Type": "String",
"Description": "The primary private IP address of the ENI. The specified IP address must have the same Host ID as the VSwitch. If no IP addresses are specified, a random network ID is assigned for the ENI."
},
"SecurityGroupIds": {
"Type": "Json",
"Description": "The IDs of the security groups that the ENI joins. The security groups and the ENI must belong to the same VPC.",
"MaxLength": 16
},
"Tags": {
"Type": "Json",
"Description": "Tags to attach to instance. Max support 20 tags to add during create instance. Each tag with two properties Key and Value, and Key is required.",
"MaxLength": 20
}
},
"Resources": {
"EniInstance": {
"Type": "ALIYUN::ECS::NetworkInterface",
"Properties": {
"Description": {
"Ref": "Description"
},
"PrivateIpAddresses": {
"Ref": "PrivateIpAddresses"
},
"ResourceGroupId": {
"Ref": "ResourceGroupId"
},
"SecondaryPrivateIpAddressCount": {
"Ref": "SecondaryPrivateIpAddressCount"
},
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"NetworkInterfaceName": {
"Ref": "NetworkInterfaceName"
},
"PrimaryIpAddress": {
"Ref": "PrimaryIpAddress"
},
"SecurityGroupIds": {
"Ref": "SecurityGroupIds"
},
"Tags": {
"Ref": "Tags"
}
}
}
},
"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"
]
}
}
}
}
YAML
format
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
Description:
Description: Description of your ENI. It is a string of [2, 256] English or Chinese
characters.
Type: String
NetworkInterfaceName:
Description: Name of your ENI. It is a string of [2, 128] Chinese or English
characters. It must begin with a letter and can contain numbers, underscores
(_), colons (:), or hyphens (-).
Type: String
PrimaryIpAddress:
Description: The primary private IP address of the ENI. The specified IP address
must have the same Host ID as the VSwitch. If no IP addresses are specified,
a random network ID is assigned for the ENI.
Type: String
PrivateIpAddresses:
Description: Specifies secondary private IP addresses of the ENI. This IP address
must be an available IP address in the CIDR block of the VSwitch to which the
ENI belongs.
MaxLength: 10
Type: Json
ResourceGroupId:
Description: Resource group id.
Type: String
SecondaryPrivateIpAddressCount:
Description: The number of private IP addresses that can be created automatically
by ECS.
Type: Number
SecurityGroupId:
Description: The ID of the security group that the ENI joins. The security group
and the ENI must be in a same VPC.
Type: String
SecurityGroupIds:
Description: The IDs of the security groups that the ENI joins. The security groups
and the ENI must belong to the same VPC.
MaxLength: 16
Type: Json
Tags:
Description: Tags to attach to instance. Max support 20 tags to add during create
instance. Each tag with two properties Key and Value, and Key is required.
MaxLength: 20
Type: Json
VSwitchId:
Description: VSwitch ID of the specified VPC. Specifies the switch ID for the
VPC.
Type: String
Resources:
EniInstance:
Properties:
Description:
Ref: Description
NetworkInterfaceName:
Ref: NetworkInterfaceName
PrimaryIpAddress:
Ref: PrimaryIpAddress
PrivateIpAddresses:
Ref: PrivateIpAddresses
ResourceGroupId:
Ref: ResourceGroupId
SecondaryPrivateIpAddressCount:
Ref: SecondaryPrivateIpAddressCount
SecurityGroupId:
Ref: SecurityGroupId
SecurityGroupIds:
Ref: SecurityGroupIds
Tags:
Ref: Tags
VSwitchId:
Ref: VSwitchId
Type: ALIYUN::ECS::NetworkInterface
Outputs:
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
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
To view more examples, visit NetworkInterfaceAttachment.json and NetworkInterfaceAttachment.yml. In the examples, the ALIYUN::ECS::NetworkInterface, ALIYUN::ECS::NetworkInterfaceAttachment, and ALIYUN::ECS::NetworkInterfacePermission resource types are used.