ALIYUN::ECS::AssignPrivateIpAddresses is used to assign secondary private IP addresses to an elastic network interface (ENI). You can specify available private IP addresses within the CIDR block of the vSwitch that is associated with the ENI. Alternatively, you can specify a number to have the specified number of private IP addresses automatically assigned to the ENI.
Syntax
{
"Type": "ALIYUN::ECS::AssignPrivateIpAddresses",
"Properties": {
"NetworkInterfaceId": String,
"SecondaryPrivateIpAddressCount": Integer,
"Ipv4Prefixes": List,
"Ipv4PrefixCount": Integer,
"PrivateIpAddresses": List
}
}Properties
Property | Type | Required | Editable | Description | Constraint |
NetworkInterfaceId | String | Yes | No | The ID of the ENI. | None. |
SecondaryPrivateIpAddressCount | Integer | No | No | The number of private IP addresses. | None. |
Ipv4Prefixes | List | No | No | The one or more IPv4 prefixes to assign to the ENI. | Example: ["192.168.**.**/28"]. You can specify up to 10 IPv4 prefixes. |
Ipv4PrefixCount | Integer | No | No | The number of IPv4 prefixes to be randomly generated for the ENI. | Valid values: 1 to 10. |
PrivateIpAddresses | List | No | No | The one or more secondary private IP addresses within the CIDR block of the vSwitch that is associated with the ENI. | If the ENI is in the Available state, a maximum of 10 IP addresses can be specified. If the ENI is in the InUse state, the number of IP addresses that can be specified varies based on the instance type. For more information, see Overview of instance families. When you assign secondary private IP addresses, you can specify only one of PrivateIpAddress and SecondaryPrivateIpAddressCount. |
Return values
Fn::GetAtt
NetworkInterfaceId: the ID of the ENI.
PrivateIpAddresses: the secondary private IP addresses.
Examples
ROSTemplateFormatVersion: '2015-09-01'
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
Resources:
AssignPrivateIpAddresses:
Type: ALIYUN::ECS::AssignPrivateIpAddresses
Properties:
NetworkInterfaceId:
Ref: NetworkInterfaceId
SecondaryPrivateIpAddressCount: 0
Outputs:
NetworkInterfaceId:
Description: The ID of the ENI.
Value:
Fn::GetAtt:
- AssignPrivateIpAddresses
- NetworkInterfaceId
PrivateIpAddresses:
Description: Assigned private ip addresses.
Value:
Fn::GetAtt:
- AssignPrivateIpAddresses
- PrivateIpAddresses{
"ROSTemplateFormatVersion": "2015-09-01",
"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
}
},
"Resources": {
"AssignPrivateIpAddresses": {
"Type": "ALIYUN::ECS::AssignPrivateIpAddresses",
"Properties": {
"NetworkInterfaceId": {
"Ref": "NetworkInterfaceId"
},
"SecondaryPrivateIpAddressCount": 0
}
}
},
"Outputs": {
"NetworkInterfaceId": {
"Description": "The ID of the ENI.",
"Value": {
"Fn::GetAtt": [
"AssignPrivateIpAddresses",
"NetworkInterfaceId"
]
}
},
"PrivateIpAddresses": {
"Description": "Assigned private ip addresses.",
"Value": {
"Fn::GetAtt": [
"AssignPrivateIpAddresses",
"PrivateIpAddresses"
]
}
}
}
}