Skip to main content

network_interfaces

Creates, updates, deletes, gets or lists a network_interfaces resource.

Overview

Namenetwork_interfaces
TypeResource
Idaws.ec2.network_interfaces

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
associated_subnetsstringThe subnets associated with this network interface.
associationstringThe association information for an Elastic IP address (IPv4) associated with the network interface.
attachmentstringThe network interface attachment.
availability_zonestringThe Availability Zone.
availability_zone_idstringThe ID of the Availability Zone.
connection_tracking_configurationstringA security group connection tracking configuration that enables you to set the timeout for connection tracking on an Elastic network interface. For more information, see Connection tracking timeouts in the Amazon EC2 User Guide.
deny_all_igw_trafficbooleanIndicates whether a network interface with an IPv6 address is unreachable from the public internet. If the value is true, inbound traffic from the internet is dropped and you cannot assign an elastic IP address to the network interface. The network interface is reachable from peered VPCs and resources connected through a transit gateway, including on-premises networks.
descriptionstringA description.
groupsstringAny security groups for the network interface.
interface_typestringThe type of network interface.
ipv_4_prefixesstringThe IPv4 prefixes that are assigned to the network interface.
ipv_6_addressstringThe IPv6 globally unique address associated with the network interface.
ipv_6_addressesstringThe IPv6 addresses associated with the network interface.
ipv_6_nativebooleanIndicates whether this is an IPv6 only network interface.
ipv_6_prefixesstringThe IPv6 prefixes that are assigned to the network interface.
mac_addressstringThe MAC address.
network_interface_idstringThe ID of the network interface.
operatorstringThe service provider that manages the network interface.
outpost_arnstringThe Amazon Resource Name (ARN) of the Outpost.
owner_idstringThe Amazon Web Services account ID of the owner of the network interface.
private_dns_namestringThe private hostname. For more information, see EC2 instance hostnames, DNS names, and domains in the Amazon EC2 User Guide.
private_ip_addressstringThe IPv4 address of the network interface within the subnet.
private_ip_addressesstringThe private IPv4 addresses associated with the network interface.
public_dns_namestringA public hostname. For more information, see EC2 instance hostnames, DNS names, and domains in the Amazon EC2 User Guide.
public_ip_dns_name_optionsstringPublic hostname type options. For more information, see EC2 instance hostnames, DNS names, and domains in the Amazon EC2 User Guide.
requester_idstringThe alias or Amazon Web Services account ID of the principal or service that created the network interface.
requester_managedbooleanIndicates whether the network interface is being managed by Amazon Web Services.
source_dest_checkbooleanIndicates whether source/destination checking is enabled.
statusstringThe status of the network interface.
subnet_idstringThe ID of the subnet.
tag_setstringAny tags assigned to the network interface.
vpc_idstringThe ID of the VPC.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_network_interfacesselectregionNextToken, MaxResults, IncludeManagedResources, DryRun, NetworkInterfaceId, FilterDescribes the specified network interfaces or all your network interfaces. If you have a large number of network interfaces, the operation fails unless you use pagination or one of the following filters: group-id, mac-address, private-dns-name, private-ip-address, subnet-id, or vpc-id. We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts.
create_network_interfaceinsertSubnetId, regionIpv4Prefix, Ipv4PrefixCount, Ipv6Prefix, Ipv6PrefixCount, InterfaceType, TagSpecification, ClientToken, EnablePrimaryIpv6, ConnectionTrackingSpecification, Operator, Description, PrivateIpAddress, SecurityGroupId, PrivateIpAddresses, SecondaryPrivateIpAddressCount, Ipv6Addresses, Ipv6AddressCount, DryRunCreates a network interface in the specified subnet. The number of IP addresses you can assign to a network interface varies by instance type. For more information about network interfaces, see Elastic network interfaces in the Amazon EC2 User Guide.
attach_network_interfaceupdateNetworkInterfaceId, InstanceId, DeviceIndex, regionNetworkCardIndex, EnaSrdSpecification, EnaQueueCount, DryRunAttaches a network interface to an instance.
modify_public_ip_dns_name_optionsupdateNetworkInterfaceId, HostnameType, regionDryRunModify public hostname options for a network interface. For more information, see EC2 instance hostnames, DNS names, and domains in the Amazon EC2 User Guide.
detach_network_interfaceupdateAttachmentId, regionDryRun, ForceDetaches a network interface from an instance.
delete_network_interfacedeleteNetworkInterfaceId, regionDryRunDeletes the specified network interface. You must detach the network interface before you can delete it.
reset_network_interface_attributeexecNetworkInterfaceId, regionDryRun, SourceDestCheckResets a network interface attribute. You can specify only one attribute at a time.

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
AttachmentIdstringThe ID of the attachment.
DeviceIndexintegerThe index of the device for the network interface attachment.
HostnameTypestringThe public hostname type. For more information, see EC2 instance hostnames, DNS names, and domains in the Amazon EC2 User Guide. public-dual-stack-dns-name: A dual-stack public hostname for a network interface. Requests from within the VPC resolve to both the private IPv4 address and the IPv6 Global Unicast Address of the network interface. Requests from the internet resolve to both the public IPv4 and the IPv6 GUA address of the network interface. public-ipv4-dns-name: An IPv4-enabled public hostname for a network interface. Requests from within the VPC resolve to the private primary IPv4 address of the network interface. Requests from the internet resolve to the public IPv4 address of the network interface. public-ipv6-dns-name: An IPv6-enabled public hostname for a network interface. Requests from within the VPC or from the internet resolve to the IPv6 GUA of the network interface.
InstanceIdstringThe ID of the instance.
NetworkInterfaceIdstringThe ID of the network interface.
SubnetIdstringThe ID of the subnet to associate with the network interface.
regionstringAWS region (default: us-east-1)
ClientTokenstringUnique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.
ConnectionTrackingSpecificationobjectA connection tracking specification for the network interface.
DescriptionstringA description for the 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.
EnaQueueCountintegerThe number of ENA queues to be created with the instance.
EnaSrdSpecificationobjectConfigures ENA Express for the network interface that this action attaches to the instance.
EnablePrimaryIpv6booleanIf you’re creating a network interface in a dual-stack or IPv6-only subnet, you have the option to assign a primary IPv6 IP address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if the instance that this ENI will be attached to relies on its IPv6 address not changing. Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.
FilterarrayOne or more filters. association.allocation-id - The allocation ID returned when you allocated the Elastic IP address (IPv4) for your network interface. association.association-id - The association ID returned when the network interface was associated with an IPv4 address. addresses.association.owner-id - The owner ID of the addresses associated with the network interface. addresses.association.public-ip - The association ID returned when the network interface was associated with the Elastic IP address (IPv4). addresses.primary - Whether the private IPv4 address is the primary IP address associated with the network interface. addresses.private-ip-address - The private IPv4 addresses associated with the network interface. association.ip-owner-id - The owner of the Elastic IP address (IPv4) associated with the network interface. association.public-ip - The address of the Elastic IP address (IPv4) bound to the network interface. association.public-dns-name - The public DNS name for the network interface (IPv4). attachment.attach-time - The time that the network interface was attached to an instance. attachment.attachment-id - The ID of the interface attachment. attachment.delete-on-termination - Indicates whether the attachment is deleted when an instance is terminated. attachment.device-index - The device index to which the network interface is attached. attachment.instance-id - The ID of the instance to which the network interface is attached. attachment.instance-owner-id - The owner ID of the instance to which the network interface is attached. attachment.status - The status of the attachment (attaching | attached | detaching | detached). availability-zone - The Availability Zone of the network interface. availability-zone-id - The ID of the Availability Zone of the network interface. description - The description of the network interface. group-id - The ID of a security group associated with the network interface. ipv6-addresses.ipv6-address - An IPv6 address associated with the network interface. interface-type - The type of network interface (api_gateway_managed | aws_codestar_connections_managed | branch | ec2_instance_connect_endpoint | efa | efa-only | efs | evs | gateway_load_balancer | gateway_load_balancer_endpoint | global_accelerator_managed | interface | iot_rules_managed | lambda | load_balancer | nat_gateway | network_load_balancer | quicksight | transit_gateway | trunk | vpc_endpoint). mac-address - The MAC address of the network interface. network-interface-id - The ID of the network interface. operator.managed - A Boolean that indicates whether this is a managed network interface. operator.principal - The principal that manages the network interface. Only valid for managed network interfaces, where managed is true. owner-id - The Amazon Web Services account ID of the network interface owner. private-dns-name - The private DNS name of the network interface (IPv4). private-ip-address - The private IPv4 address or addresses of the network interface. requester-id - The alias or Amazon Web Services account ID of the principal or service that created the network interface. requester-managed - Indicates whether the network interface is being managed by an Amazon Web Services service (for example, Amazon Web Services Management Console, Auto Scaling, and so on). source-dest-check - Indicates whether the network interface performs source/destination checking. A value of true means checking is enabled, and false means checking is disabled. The value must be false for the network interface to perform network address translation (NAT) in your VPC. status - The status of the network interface. If the network interface is not attached to an instance, the status is available; if a network interface is attached to an instance the status is in-use. subnet-id - The ID of the subnet for the network interface. 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. vpc-id - The ID of the VPC for the network interface.
ForcebooleanSpecifies whether to force a detachment. Use the Force parameter only as a last resort to detach a network interface from a failed instance. If you use the Force parameter to detach a network interface, you might not be able to attach a different network interface to the same index on the instance without first stopping and starting the instance. If you force the detachment of a network interface, the instance metadata might not get updated. This means that the attributes associated with the detached network interface might still be visible. The instance metadata will get updated when you stop and start the instance.
IncludeManagedResourcesbooleanIndicates whether to include managed resources in the output. If this parameter is set to true, the output includes resources that are managed by Amazon Web Services services, even if managed resource visibility is set to hidden.
InterfaceTypestringThe type of network interface. The default is interface. If you specify efa-only, do not assign any IP addresses to the network interface. EFA-only network interfaces do not support IP addresses. The only supported values are interface, efa, efa-only, and trunk.
Ipv4PrefixarrayThe IPv4 prefixes assigned to the network interface. You can't specify IPv4 prefixes if you've specified one of the following: a count of IPv4 prefixes, specific private IPv4 addresses, or a count of private IPv4 addresses.
Ipv4PrefixCountintegerThe number of IPv4 prefixes that Amazon Web Services automatically assigns to the network interface. You can't specify a count of IPv4 prefixes if you've specified one of the following: specific IPv4 prefixes, specific private IPv4 addresses, or a count of private IPv4 addresses.
Ipv6AddressCountintegerThe number of IPv6 addresses to assign to a network interface. Amazon EC2 automatically selects the IPv6 addresses from the subnet range. You can't specify a count of IPv6 addresses using this parameter if you've specified one of the following: specific IPv6 addresses, specific IPv6 prefixes, or a count of IPv6 prefixes. If your subnet has the AssignIpv6AddressOnCreation attribute set, you can override that setting by specifying 0 as the IPv6 address count.
Ipv6AddressesarrayThe IPv6 addresses from the IPv6 CIDR block range of your subnet. You can't specify IPv6 addresses using this parameter if you've specified one of the following: a count of IPv6 addresses, specific IPv6 prefixes, or a count of IPv6 prefixes.
Ipv6PrefixarrayThe IPv6 prefixes assigned to the network interface. You can't specify IPv6 prefixes if you've specified one of the following: a count of IPv6 prefixes, specific IPv6 addresses, or a count of IPv6 addresses.
Ipv6PrefixCountintegerThe number of IPv6 prefixes that Amazon Web Services automatically assigns to the network interface. You can't specify a count of IPv6 prefixes if you've specified one of the following: specific IPv6 prefixes, specific IPv6 addresses, or a count of IPv6 addresses.
MaxResultsintegerThe maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. You cannot specify this parameter and the network interface IDs parameter in the same request. For more information, see Pagination.
NetworkCardIndexintegerThe index of the network card. Some instance types support multiple network cards. The primary network interface must be assigned to network card index 0. The default is network card index 0.
NetworkInterfaceIdarrayThe network interface IDs. Default: Describes all your network interfaces.
NextTokenstringThe token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.
OperatorobjectReserved for internal use.
PrivateIpAddressstringThe primary private IPv4 address of the network interface. If you don't specify an IPv4 address, Amazon EC2 selects one for you from the subnet's IPv4 CIDR range. If you specify an IP address, you cannot indicate any IP addresses specified in privateIpAddresses as primary (only one IP address can be designated as primary).
PrivateIpAddressesarrayThe private IPv4 addresses. You can't specify private IPv4 addresses if you've specified one of the following: a count of private IPv4 addresses, specific IPv4 prefixes, or a count of IPv4 prefixes.
SecondaryPrivateIpAddressCountintegerThe number of secondary private IPv4 addresses to assign to a network interface. When you specify a number of secondary IPv4 addresses, Amazon EC2 selects these IP addresses within the subnet's IPv4 CIDR range. You can't specify this option and specify more than one private IP address using privateIpAddresses. You can't specify a count of private IPv4 addresses if you've specified one of the following: specific private IPv4 addresses, specific IPv4 prefixes, or a count of IPv4 prefixes.
SecurityGroupIdarrayThe IDs of the security groups.
SourceDestCheckstringThe source/destination checking attribute. Resets the value to true.
TagSpecificationarrayThe tags to apply to the new network interface.

SELECT examples

Describes the specified network interfaces or all your network interfaces. If you have a large number of network interfaces, the operation fails unless you use pagination or one of the following filters: group-id, mac-address, private-dns-name, private-ip-address, subnet-id, or vpc-id. We strongly recommend using only paginated requests. Unpaginated requests are susceptible to throttling and timeouts.

SELECT
associated_subnets,
association,
attachment,
availability_zone,
availability_zone_id,
connection_tracking_configuration,
deny_all_igw_traffic,
description,
groups,
interface_type,
ipv_4_prefixes,
ipv_6_address,
ipv_6_addresses,
ipv_6_native,
ipv_6_prefixes,
mac_address,
network_interface_id,
operator,
outpost_arn,
owner_id,
private_dns_name,
private_ip_address,
private_ip_addresses,
public_dns_name,
public_ip_dns_name_options,
requester_id,
requester_managed,
source_dest_check,
status,
subnet_id,
tag_set,
vpc_id
FROM aws.ec2.network_interfaces
WHERE region = '{{ region }}' -- required
AND NextToken = '{{ NextToken }}'
AND MaxResults = '{{ MaxResults }}'
AND IncludeManagedResources = '{{ IncludeManagedResources }}'
AND DryRun = '{{ DryRun }}'
AND NetworkInterfaceId = '{{ NetworkInterfaceId }}'
AND Filter = '{{ Filter }}'
;

INSERT examples

Creates a network interface in the specified subnet. The number of IP addresses you can assign to a network interface varies by instance type. For more information about network interfaces, see Elastic network interfaces in the Amazon EC2 User Guide.

INSERT INTO aws.ec2.network_interfaces (
SubnetId,
region,
Ipv4Prefix,
Ipv4PrefixCount,
Ipv6Prefix,
Ipv6PrefixCount,
InterfaceType,
TagSpecification,
ClientToken,
EnablePrimaryIpv6,
ConnectionTrackingSpecification,
Operator,
Description,
PrivateIpAddress,
SecurityGroupId,
PrivateIpAddresses,
SecondaryPrivateIpAddressCount,
Ipv6Addresses,
Ipv6AddressCount,
DryRun
)
SELECT
'{{ SubnetId }}',
'{{ region }}',
'{{ Ipv4Prefix }}',
'{{ Ipv4PrefixCount }}',
'{{ Ipv6Prefix }}',
'{{ Ipv6PrefixCount }}',
'{{ InterfaceType }}',
'{{ TagSpecification }}',
'{{ ClientToken }}',
'{{ EnablePrimaryIpv6 }}',
'{{ ConnectionTrackingSpecification }}',
'{{ Operator }}',
'{{ Description }}',
'{{ PrivateIpAddress }}',
'{{ SecurityGroupId }}',
'{{ PrivateIpAddresses }}',
'{{ SecondaryPrivateIpAddressCount }}',
'{{ Ipv6Addresses }}',
'{{ Ipv6AddressCount }}',
'{{ DryRun }}'
RETURNING
associated_subnets,
association,
attachment,
availability_zone,
availability_zone_id,
connection_tracking_configuration,
deny_all_igw_traffic,
description,
groups,
interface_type,
ipv_4_prefixes,
ipv_6_address,
ipv_6_addresses,
ipv_6_native,
ipv_6_prefixes,
mac_address,
network_interface_id,
operator,
outpost_arn,
owner_id,
private_dns_name,
private_ip_address,
private_ip_addresses,
public_dns_name,
public_ip_dns_name_options,
requester_id,
requester_managed,
source_dest_check,
status,
subnet_id,
tag_set,
vpc_id
;

UPDATE examples

Attaches a network interface to an instance.

UPDATE aws.ec2.network_interfaces
SET
-- No updatable properties
WHERE
NetworkInterfaceId = '{{ NetworkInterfaceId }}' --required
AND InstanceId = '{{ InstanceId }}' --required
AND DeviceIndex = '{{ DeviceIndex }}' --required
AND region = '{{ region }}' --required
AND NetworkCardIndex = '{{ NetworkCardIndex}}'
AND EnaSrdSpecification = '{{ EnaSrdSpecification}}'
AND EnaQueueCount = '{{ EnaQueueCount}}'
AND DryRun = {{ DryRun}}
RETURNING
attachment_id,
network_card_index;

DELETE examples

Deletes the specified network interface. You must detach the network interface before you can delete it.

DELETE FROM aws.ec2.network_interfaces
WHERE NetworkInterfaceId = '{{ NetworkInterfaceId }}' --required
AND region = '{{ region }}' --required
AND DryRun = '{{ DryRun }}'
;

Lifecycle Methods

Resets a network interface attribute. You can specify only one attribute at a time.

EXEC aws.ec2.network_interfaces.reset_network_interface_attribute
@NetworkInterfaceId='{{ NetworkInterfaceId }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }},
@SourceDestCheck='{{ SourceDestCheck }}'
;