ALIYUN::ECS::AssignPrivateIpAddresses类型用于为一块弹性网卡分配一个或多个辅助私有IP地址。您可以为网卡指定所属虚拟交换机(VSwitch)的CIDR私有IP地址,也可以通过指定私有网络地址数量自动创建私有IP地址。
语法
{
"Type": "ALIYUN::ECS::AssignPrivateIpAddresses",
"Properties": {
"NetworkInterfaceId": String,
"SecondaryPrivateIpAddressCount": Integer,
"PrivateIpAddresses": List
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
NetworkInterfaceId | String | 是 | 否 | 弹性网卡ID。 | 无。 |
SecondaryPrivateIpAddressCount | Integer | 否 | 否 | 指定的私有IP地址数量。 | 无。 |
PrivateIpAddresses | List | 否 | 否 | 弹性网卡所属虚拟交换机的CIDR地址段中的一个或多个辅助私有IP地址。 | 弹性网卡处于可用(Available)状态时,可以设置的IP数量为:1~10个。弹性网卡处于已绑定(InUse)状态时,可以设置的IP数量将受限于实例规格,详情请参见实例规格族。分配辅助私有IP地址时,不能同时指定参数PrivateIpAddress和参数SecondaryPrivateIpAddressCount。 |
返回值
Fn::GetAtt
- NetworkInterfaceId:弹性网卡ID。
- PrivateIpAddresses:辅助私有IP地址。
示例
JSON
格式
{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"AssignPrivateIpAddresses": {
"Type": "ALIYUN::ECS::AssignPrivateIpAddresses",
"Properties": {
"NetworkInterfaceId": {
"Ref": "NetworkInterfaceId"
},
"SecondaryPrivateIpAddressCount": {
"Ref": "SecondaryPrivateIpAddressCount"
},
"PrivateIpAddresses": {
"Fn::Split": [
",",
{
"Ref": "PrivateIpAddresses"
}
]
}
}
}
},
"Parameters": {
"NetworkInterfaceId": {
"Type": "String",
"Description": "The ID of the ENI."
},
"SecondaryPrivateIpAddressCount": {
"Type": "Number",
"Description": "The specified number of private IP addresses to be assigned by the ECS instance.",
"MinValue": 0
},
"PrivateIpAddresses": {
"Type": "CommaDelimitedList",
"Description": "One or multiple secondary private IP addresses selected from the CIDR block of the VSwitch that hosts the ENI. Valid values of number of private ip addresses:When the ENI is in the Available state: 1 to 10.When the ENI is in the InUse state: limited by the instance type. For more information, see Instance type families.You must specify either the PrivateIpAddresses parameter or the SecondaryPrivateIpAddressCount parameter to assign secondary private IP addresses.",
"MaxLength": 10
}
},
"Outputs": {
"NetworkInterfaceId": {
"Description": "The ID of the ENI.",
"Value": {
"Fn::GetAtt": [
"AssignPrivateIpAddresses",
"NetworkInterfaceId"
]
}
},
"PrivateIpAddresses": {
"Description": "Assigned private ip addresses.",
"Value": {
"Fn::GetAtt": [
"AssignPrivateIpAddresses",
"PrivateIpAddresses"
]
}
}
}
}
YAML
格式
ROSTemplateFormatVersion: '2015-09-01'
Resources:
AssignPrivateIpAddresses:
Type: ALIYUN::ECS::AssignPrivateIpAddresses
Properties:
NetworkInterfaceId:
Ref: NetworkInterfaceId
SecondaryPrivateIpAddressCount:
Ref: SecondaryPrivateIpAddressCount
PrivateIpAddresses:
Fn::Split:
- ","
- Ref: PrivateIpAddresses
Parameters:
NetworkInterfaceId:
Type: String
Description: The ID of the ENI.
SecondaryPrivateIpAddressCount:
Type: Number
Description: The specified number of private IP addresses to be assigned by the
ECS instance.
MinValue: 0
PrivateIpAddresses:
Type: CommaDelimitedList
Description: 'One or multiple secondary private IP addresses selected from the
CIDR block of the VSwitch that hosts the ENI. Valid values of number of private
ip addresses:When the ENI is in the Available state: 1 to 10.When the ENI is
in the InUse state: limited by the instance type. For more information, see
Instance type families.You must specify either the PrivateIpAddresses parameter
or the SecondaryPrivateIpAddressCount parameter to assign secondary private
IP addresses.'
MaxLength: 10
Outputs:
NetworkInterfaceId:
Description: The ID of the ENI.
Value:
Fn::GetAtt:
- AssignPrivateIpAddresses
- NetworkInterfaceId
PrivateIpAddresses:
Description: Assigned private ip addresses.
Value:
Fn::GetAtt:
- AssignPrivateIpAddresses
- PrivateIpAddresses
在文档使用中是否遇到以下问题
更多建议
匿名提交