Skip to content

EC2  >  Operations  >  allocate_address

allocate_address

Operation

allocate_address async

allocate_address(request: AllocateAddressInput | AllocateAddressInputDict, /, *, plugins: list[Plugin] | None = None) -> AllocateAddressOutput
allocate_address(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[AllocateAddressInputDict]) -> AllocateAddressOutput

Allocates an Elastic IP address to your Amazon Web Services account. After you allocate the Elastic IP address you can associate it with an instance or network interface. After you release an Elastic IP address, it is released to the IP address pool and can be allocated to a different Amazon Web Services account.

You can allocate an Elastic IP address from one of the following address pools:

  • Amazon's pool of IPv4 addresses

  • Public IPv4 address range that you own and bring to your Amazon Web Services account using Bring Your Own IP Addresses (BYOIP)

  • An IPv4 IPAM pool with an Amazon-provided or BYOIP public IPv4 address range

  • IPv4 addresses from your on-premises network made available for use with an Outpost using a customer-owned IP address pool (CoIP pool)

For more information, see Elastic IP Addresses in the Amazon EC2 User Guide.

If you release an Elastic IP address, you might be able to recover it. You cannot recover an Elastic IP address that you released after it is allocated to another Amazon Web Services account. To attempt to recover an Elastic IP address that you released, specify it in this operation.

You can allocate a carrier IP address which is a public IP address from a telecommunication carrier, to a network interface which resides in a subnet in a Wavelength Zone (for example an EC2 instance).

Parameters:

Name Type Description Default
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

Returns:

Type Description
AllocateAddressOutput

An instance of AllocateAddressOutput.

Input

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

Model

AllocateAddressInput dataclass

Bases: _SerdeShape

Dataclass for AllocateAddressInput structure.

Attributes
address class-attribute instance-attribute
address: str | None = ...

The Elastic IP address to recover or an IPv4 address from an address pool.

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

The ID of a customer-owned address pool. Use this parameter to let Amazon EC2 select an address from the address pool. Alternatively, specify a specific address from the address pool.

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

The network (vpc).

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

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

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

The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it. For more information, see Allocate sequential Elastic IP addresses from an IPAM pool in the Amazon VPC IPAM User Guide.

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

A unique set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises IP addresses. Use this parameter to limit the IP address to this location. IP addresses cannot move between network border groups.

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

The ID of an address pool that you own. Use this parameter to let Amazon EC2 select an address from the address pool. To specify a specific address from the address pool, use the Address parameter instead.

tag_specifications class-attribute instance-attribute
tag_specifications: list[TagSpecification] | None = ...

The tags to assign to the Elastic IP address.

Dictionaries

AllocateAddressInputDict

Bases: TypedDict

Dictionary form of AllocateAddressInput.

Attributes
address instance-attribute
address: str | None

The Elastic IP address to recover or an IPv4 address from an address pool.

customer_owned_ipv4_pool instance-attribute
customer_owned_ipv4_pool: str | None

The ID of a customer-owned address pool. Use this parameter to let Amazon EC2 select an address from the address pool. Alternatively, specify a specific address from the address pool.

domain instance-attribute
domain: str | None

The network (vpc).

dry_run instance-attribute
dry_run: bool | None

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

ipam_pool_id instance-attribute
ipam_pool_id: str | None

The ID of an IPAM pool which has an Amazon-provided or BYOIP public IPv4 CIDR provisioned to it. For more information, see Allocate sequential Elastic IP addresses from an IPAM pool in the Amazon VPC IPAM User Guide.

network_border_group instance-attribute
network_border_group: str | None

A unique set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises IP addresses. Use this parameter to limit the IP address to this location. IP addresses cannot move between network border groups.

public_ipv4_pool instance-attribute
public_ipv4_pool: str | None

The ID of an address pool that you own. Use this parameter to let Amazon EC2 select an address from the address pool. To specify a specific address from the address pool, use the Address parameter instead.

tag_specifications instance-attribute
tag_specifications: Sequence[TagSpecification | TagSpecificationDict] | None

The tags to assign to the Elastic IP address.

Output

AllocateAddressOutput dataclass

Bases: _SerdeShape

Dataclass for AllocateAddressOutput structure.

Attributes

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

The ID that represents the allocation of the Elastic IP address.

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

The carrier IP address. Available only for network interfaces that reside in a subnet in a Wavelength Zone.

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

The customer-owned IP address.

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

The ID of the customer-owned address pool.

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

The network (vpc).

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

The set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises IP addresses.

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

The Amazon-owned IP address. Not available when using an address pool that you own.

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

The ID of an address pool that you own.

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.