addresses
Creates, updates, deletes, gets or lists an addresses resource.
Overview
| Name | addresses |
| Type | Resource |
| Id | aws.ec2.addresses |
Fields
The following fields are returned by SELECT queries:
- describe_addresses
| Name | Datatype | Description |
|---|---|---|
allocation_id | string | The ID representing the allocation of the address. |
association_id | string | The ID representing the association of the address with an instance. |
carrier_ip | string | The 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_ip | string | The customer-owned IP address. |
customer_owned_ipv_4_pool | string | The ID of the customer-owned address pool. |
domain | string | The network (vpc). |
instance_id | string | The ID of the instance that the address is associated with (if any). |
network_border_group | string | The name of the unique set of Availability Zones, Local Zones, or Wavelength Zones from which Amazon Web Services advertises IP addresses. |
network_interface_id | string | The ID of the network interface. |
network_interface_owner_id | string | The ID of the Amazon Web Services account that owns the network interface. |
private_ip_address | string | The private IP address associated with the Elastic IP address. |
public_ip | string | The Elastic IP address. |
public_ipv_4_pool | string | The ID of an address pool. |
service_managed | string | The service that manages the elastic IP address. The only option supported today is alb. |
subnet_id | string | The ID of the subnet where the IP address is allocated. |
tags | string | Any tags assigned to the Elastic IP address. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_addresses | select | region | PublicIp, DryRun, Filter, AllocationId | Describes the specified Elastic IP addresses or all of your Elastic IP addresses. |
assign_ipv6_addresses | update | NetworkInterfaceId, region | Ipv6PrefixCount, Ipv6Prefix, Ipv6Addresses, Ipv6AddressCount | 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. |
assign_private_ip_addresses | exec | NetworkInterfaceId, region | Ipv4Prefix, Ipv4PrefixCount, PrivateIpAddress, SecondaryPrivateIpAddressCount, AllowReassignment | 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. |
unassign_ipv6_addresses | exec | NetworkInterfaceId, region | Ipv6Prefix, Ipv6Addresses | Unassigns the specified IPv6 addresses or Prefix Delegation prefixes from a network interface. |
unassign_private_ip_addresses | exec | NetworkInterfaceId, region | Ipv4Prefix, PrivateIpAddress | Unassigns 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.
| Name | Datatype | Description |
|---|---|---|
NetworkInterfaceId | string | The ID of the network interface. |
region | string | AWS region (default: us-east-1) |
AllocationId | array | Information about the allocation IDs. |
AllowReassignment | boolean | 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. |
DryRun | boolean | 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. |
Filter | array | One 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. |
Ipv4Prefix | array | The IPv4 prefixes to unassign from the network interface. |
Ipv4PrefixCount | integer | 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. |
Ipv6AddressCount | integer | The 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. |
Ipv6Addresses | array | The IPv6 addresses to unassign from the network interface. |
Ipv6Prefix | array | The IPv6 prefixes to unassign from the network interface. |
Ipv6PrefixCount | integer | The 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. |
PrivateIpAddress | array | The secondary private IP addresses to unassign from the network interface. You can specify this option multiple times to unassign more than one IP address. |
PublicIp | array | One or more Elastic IP addresses. Default: Describes all your Elastic IP addresses. |
SecondaryPrivateIpAddressCount | integer | The 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
- describe_addresses
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
- assign_ipv6_addresses
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
- assign_private_ip_addresses
- unassign_ipv6_addresses
- unassign_private_ip_addresses
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 }}
;
Unassigns the specified IPv6 addresses or Prefix Delegation prefixes from a network interface.
EXEC aws.ec2.addresses.unassign_ipv6_addresses
@NetworkInterfaceId='{{ NetworkInterfaceId }}' --required,
@region='{{ region }}' --required,
@Ipv6Prefix='{{ Ipv6Prefix }}',
@Ipv6Addresses='{{ Ipv6Addresses }}'
;
Unassigns the specified secondary private IP addresses or IPv4 Prefix Delegation prefixes from a network interface.
EXEC aws.ec2.addresses.unassign_private_ip_addresses
@NetworkInterfaceId='{{ NetworkInterfaceId }}' --required,
@region='{{ region }}' --required,
@Ipv4Prefix='{{ Ipv4Prefix }}',
@PrivateIpAddress='{{ PrivateIpAddress }}'
;