Skip to main content

addresses

Creates, updates, deletes, gets or lists an addresses resource.

Overview

Nameaddresses
TypeResource
Idaws.ec2.addresses

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
allocation_idstringThe ID representing the allocation of the address.
association_idstringThe ID representing the association of the address with an instance.
carrier_ipstringThe carrier IP address associated. This option is only available for network interfaces which reside in a subnet in a Wavelength Zone (for example an EC2 instance).
customer_owned_ipstringThe customer-owned IP address.
customer_owned_ipv_4_poolstringThe ID of the customer-owned address pool.
domainstringThe network (vpc).
instance_idstringThe ID of the instance that the address is associated with (if any).
network_border_groupstringThe name of the unique set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises IP addresses.
network_interface_idstringThe ID of the network interface.
network_interface_owner_idstringThe ID of the Amazon Web Services account that owns the network interface.
private_ip_addressstringThe private IP address associated with the Elastic IP address.
public_ipstringThe Elastic IP address.
public_ipv_4_poolstringThe ID of an address pool.
service_managedstringThe service that manages the elastic IP address. The only option supported today is alb.
subnet_idstringThe ID of the subnet where the IP address is allocated.
tagsstringAny tags assigned to the Elastic IP address.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_addressesselectregionPublicIp, DryRun, Filter, AllocationIdDescribes the specified Elastic IP addresses or all of your Elastic IP addresses.
assign_ipv6_addressesupdateNetworkInterfaceId, regionIpv6PrefixCount, Ipv6Prefix, Ipv6Addresses, Ipv6AddressCountAssigns the specified IPv6 addresses to the specified network interface. You can specify specific IPv6 addresses, or you can specify the number of IPv6 addresses to be automatically assigned from the subnet's IPv6 CIDR block range. You can assign as many IPv6 addresses to a network interface as you can assign private IPv4 addresses, and the limit varies by instance type. You must specify either the IPv6 addresses or the IPv6 address count in the request. You can optionally use Prefix Delegation on the network interface. You must specify either the IPV6 Prefix Delegation prefixes, or the IPv6 Prefix Delegation count. For information, see Assigning prefixes to network interfaces in the Amazon EC2 User Guide.
assign_private_ip_addressesexecNetworkInterfaceId, regionIpv4Prefix, Ipv4PrefixCount, PrivateIpAddress, SecondaryPrivateIpAddressCount, AllowReassignmentAssigns 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.
unassign_ipv6_addressesexecNetworkInterfaceId, regionIpv6Prefix, Ipv6AddressesUnassigns the specified IPv6 addresses or Prefix Delegation prefixes from a network interface.
unassign_private_ip_addressesexecNetworkInterfaceId, regionIpv4Prefix, PrivateIpAddressUnassigns the specified secondary private IP addresses or IPv4 Prefix Delegation prefixes from a network interface.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
NetworkInterfaceIdstringThe ID of the network interface.
regionstringAWS region (default: us-east-1)
AllocationIdarrayInformation about the allocation IDs.
AllowReassignmentbooleanIndicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.
DryRunbooleanChecks 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.
FilterarrayOne or more filters. Filter names and values are case-sensitive. allocation-id - The allocation ID for the address. association-id - The association ID for the address. instance-id - The ID of the instance the address is associated with, if any. network-border-group - A unique set of Availability Zones, Local Zones, or Wavelength Zones from where Amazon Web Services advertises IP addresses. network-interface-id - The ID of the network interface that the address is associated with, if any. network-interface-owner-id - The Amazon Web Services account ID of the owner. private-ip-address - The private IP address associated with the Elastic IP address. public-ip - The Elastic IP address, or the carrier IP address. tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value. tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.
Ipv4PrefixarrayThe IPv4 prefixes to unassign from the network interface.
Ipv4PrefixCountintegerThe 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.
Ipv6AddressCountintegerThe number of additional IPv6 addresses to assign to the network interface. The specified number of IPv6 addresses are assigned in addition to the existing IPv6 addresses that are already assigned to the network interface. Amazon EC2 automatically selects the IPv6 addresses from the subnet range. You can't use this option if specifying specific IPv6 addresses.
Ipv6AddressesarrayThe IPv6 addresses to unassign from the network interface.
Ipv6PrefixarrayThe IPv6 prefixes to unassign from the network interface.
Ipv6PrefixCountintegerThe number of IPv6 prefixes that Amazon Web Services automatically assigns to the network interface. You cannot use this option if you use the Ipv6Prefixes option.
PrivateIpAddressarrayThe secondary private IP addresses to unassign from the network interface. You can specify this option multiple times to unassign more than one IP address.
PublicIparrayOne or more Elastic IP addresses. Default: Describes all your Elastic IP addresses.
SecondaryPrivateIpAddressCountintegerThe number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.

SELECT examples

Describes the specified Elastic IP addresses or all of your Elastic IP addresses.

SELECT
allocation_id,
association_id,
carrier_ip,
customer_owned_ip,
customer_owned_ipv_4_pool,
domain,
instance_id,
network_border_group,
network_interface_id,
network_interface_owner_id,
private_ip_address,
public_ip,
public_ipv_4_pool,
service_managed,
subnet_id,
tags
FROM aws.ec2.addresses
WHERE region = '{{ region }}' -- required
AND PublicIp = '{{ PublicIp }}'
AND DryRun = '{{ DryRun }}'
AND Filter = '{{ Filter }}'
AND AllocationId = '{{ AllocationId }}'
;

UPDATE examples

Assigns the specified IPv6 addresses to the specified network interface. You can specify specific IPv6 addresses, or you can specify the number of IPv6 addresses to be automatically assigned from the subnet's IPv6 CIDR block range. You can assign as many IPv6 addresses to a network interface as you can assign private IPv4 addresses, and the limit varies by instance type. You must specify either the IPv6 addresses or the IPv6 address count in the request. You can optionally use Prefix Delegation on the network interface. You must specify either the IPV6 Prefix Delegation prefixes, or the IPv6 Prefix Delegation count. For information, see Assigning prefixes to network interfaces in the Amazon EC2 User Guide.

UPDATE aws.ec2.addresses
SET
-- No updatable properties
WHERE
NetworkInterfaceId = '{{ NetworkInterfaceId }}' --required
AND region = '{{ region }}' --required
AND Ipv6PrefixCount = '{{ Ipv6PrefixCount}}'
AND Ipv6Prefix = '{{ Ipv6Prefix}}'
AND Ipv6Addresses = '{{ Ipv6Addresses}}'
AND Ipv6AddressCount = '{{ Ipv6AddressCount}}'
RETURNING
assigned_ipv_6_addresses,
assigned_ipv_6_prefixes,
network_interface_id;

Lifecycle Methods

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.

EXEC aws.ec2.addresses.assign_private_ip_addresses
@NetworkInterfaceId='{{ NetworkInterfaceId }}' --required,
@region='{{ region }}' --required,
@Ipv4Prefix='{{ Ipv4Prefix }}',
@Ipv4PrefixCount='{{ Ipv4PrefixCount }}',
@PrivateIpAddress='{{ PrivateIpAddress }}',
@SecondaryPrivateIpAddressCount='{{ SecondaryPrivateIpAddressCount }}',
@AllowReassignment={{ AllowReassignment }}
;