Skip to content

assign_private_ip_addresses

Operation

assign_private_ip_addresses

assign_private_ip_addresses(request: AssignPrivateIpAddressesInput | AssignPrivateIpAddressesInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[AssignPrivateIpAddressesInputDict]) -> AssignPrivateIpAddressesOutput

Assigns the specified secondary private IP addresses to the specified network interface.

You can specify specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned from the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For more information about Elastic IP addresses, see Elastic IP Addresses in the Amazon EC2 User Guide.

When you move a secondary private IP address to another network interface, any Elastic IP address that is associated with the IP address is also moved.

Remapping an IP address is an asynchronous operation. When you move an IP address from one network interface to another, check network/interfaces/macs/mac/local-ipv4s in the instance metadata to confirm that the remapping is complete.

You must specify either the IP addresses or the IP address count in the request.

You can optionally use Prefix Delegation on the network interface. You must specify either the IPv4 Prefix Delegation prefixes, or the IPv4 Prefix Delegation count. For information, see Assigning prefixes to network interfaces in the Amazon EC2 User Guide.

Parameters:

Name Type Description Default
request AssignPrivateIpAddressesInput | AssignPrivateIpAddressesInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[AssignPrivateIpAddressesInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
AssignPrivateIpAddressesOutput

An instance of AssignPrivateIpAddressesOutput.

assign_private_ip_addresses async

assign_private_ip_addresses(request: AssignPrivateIpAddressesInput | AssignPrivateIpAddressesInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[AssignPrivateIpAddressesInputDict]) -> AssignPrivateIpAddressesOutput

Assigns the specified secondary private IP addresses to the specified network interface.

You can specify specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned from the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For more information about Elastic IP addresses, see Elastic IP Addresses in the Amazon EC2 User Guide.

When you move a secondary private IP address to another network interface, any Elastic IP address that is associated with the IP address is also moved.

Remapping an IP address is an asynchronous operation. When you move an IP address from one network interface to another, check network/interfaces/macs/mac/local-ipv4s in the instance metadata to confirm that the remapping is complete.

You must specify either the IP addresses or the IP address count in the request.

You can optionally use Prefix Delegation on the network interface. You must specify either the IPv4 Prefix Delegation prefixes, or the IPv4 Prefix Delegation count. For information, see Assigning prefixes to network interfaces in the Amazon EC2 User Guide.

Parameters:

Name Type Description Default
request AssignPrivateIpAddressesInput | AssignPrivateIpAddressesInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[AssignPrivateIpAddressesInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
AssignPrivateIpAddressesOutput

An instance of AssignPrivateIpAddressesOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

AssignPrivateIpAddressesInputDict

Bases: TypedDict

Dictionary form of AssignPrivateIpAddressesInput.

Attributes

allow_reassignment instance-attribute
allow_reassignment: bool | None

Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.

ipv4_prefix_count instance-attribute
ipv4_prefix_count: int | None

The number of IPv4 prefixes that Amazon Web Services automatically assigns to the network interface. You can't use this option if you use the Ipv4 Prefixes option.

ipv4_prefixes instance-attribute
ipv4_prefixes: Sequence[str] | None

One or more IPv4 prefixes assigned to the network interface. You can't use this option if you use the Ipv4PrefixCount option.

network_interface_id instance-attribute
network_interface_id: Required[str]

The ID of the network interface.

private_ip_addresses instance-attribute
private_ip_addresses: Sequence[str] | None

The IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

secondary_private_ip_address_count instance-attribute
secondary_private_ip_address_count: int | None

The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.

AssignPrivateIpAddressesInput dataclass

Bases: _SerdeShape

Contains the parameters for AssignPrivateIpAddresses.

Attributes

allow_reassignment class-attribute instance-attribute
allow_reassignment: bool | None = ...

Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.

ipv4_prefix_count class-attribute instance-attribute
ipv4_prefix_count: int | None = ...

The number of IPv4 prefixes that Amazon Web Services automatically assigns to the network interface. You can't use this option if you use the Ipv4 Prefixes option.

ipv4_prefixes class-attribute instance-attribute
ipv4_prefixes: list[str] | None = ...

One or more IPv4 prefixes assigned to the network interface. You can't use this option if you use the Ipv4PrefixCount option.

network_interface_id class-attribute instance-attribute
network_interface_id: str | None = ...

The ID of the network interface.

private_ip_addresses class-attribute instance-attribute
private_ip_addresses: list[str] | None = ...

The IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.

If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.

secondary_private_ip_address_count class-attribute instance-attribute
secondary_private_ip_address_count: int | None = ...

The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.

Output

AssignPrivateIpAddressesOutput dataclass

Bases: _SerdeShape

Dataclass for AssignPrivateIpAddressesOutput structure.

Attributes

assigned_ipv4_prefixes class-attribute instance-attribute
assigned_ipv4_prefixes: list[Ipv4PrefixSpecification] | None = ...

The IPv4 prefixes that are assigned to the network interface.

assigned_private_ip_addresses class-attribute instance-attribute
assigned_private_ip_addresses: list[AssignedPrivateIpAddress] | None = ...

The private IP addresses assigned to the network interface.

network_interface_id class-attribute instance-attribute
network_interface_id: str | None = ...

The ID of the network interface.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.