| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Assigns one or more secondary private IP addresses to the specified network interface. You can specify one or more specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned within the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For information about instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide. For more information about Elastic IP addresses, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide.
This action is available only in EC2-VPC.
NetworkInterfaceIdThe network interface to which the IP address is assigned.
Type: String
Default: None
Required: Yes
PrivateIpAddress.nThe IP address to be assigned as a secondary private IP address to the network interface.
This option can be used multiple times to assign multiple secondary private IP addresses to the network interface.
Type: AssignPrivateIpAddressesSetItemRequestType
Default: None
Required: Conditional
Condition: You cannot specify this parameter when also specifying SecondaryPrivateIpAddressCount.
SecondaryPrivateIpAddressCountThe number of secondary IP addresses to assign to the network interface.
Type: Integer
Default: None
Required: Conditional
Condition: You cannot specify this parameter when also specifying PrivateIPAddress.n.
AllowReassignmentSpecifies whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.
Type: Boolean
Default: False
Required: No
The following elements are returned in an
AssignPrivateIpAddressesResponse element.
requestIdThe ID of the request.
Type: xsd:string
returnReturns true if the request succeeds. Otherwise, returns an error.
Type: xsd:boolean
This example assigns two secondary private IP addresses (10.0.2.1 and 10.0.2.11) to the specified network interface.
https://ec2.amazonaws.com/?Action=AssignPrivateIpAddresses &NetworkInterfaceId=eni-d83388b1 &PrivateIpAddress.0=10.0.2.1 &PrivateIpAddress.1=10.0.2.11 &AUTHPARAMS
<AssignPrivateIpAddresses xmlns="http://ec2.amazonaws.com/doc/2013-02-01/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <return>true</return> </AssignPrivateIpAddresses>
This example assigns two secondary private IP addresses to the network interface. The IP addresses are automatically assigned from the available IP addresses within the subnet's CIDR block range.
https://ec2.amazonaws.com/?Action=AssignPrivateIpAddresses &NetworkInterfaceId=eni-d83388b1 &SecondaryPrivateIpAddressCount=2 &AUTHPARAMS
<AssignPrivateIpAddresses xmlns="http://ec2.amazonaws.com/doc/2013-02-01/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <return>true</return> </AssignPrivateIpAddresses>