steampipe plugin install aws

Table: aws_ec2_network_interface - Query AWS EC2 Network Interfaces using SQL

An AWS EC2 Network Interface is a virtual network interface that you can attach to an instance in a VPC. Network interfaces are the point of networking for any instance that is attached to a Virtual Private Cloud (VPC). They can include a primary private IPv4 address, one or more secondary private IPv4 addresses, one Elastic IP address per private IPv4 address, one public IPv4 address, one or more IPv6 addresses, a MAC address, one or more security groups, a source/destination check flag, and a description.

Table Usage Guide

The aws_ec2_network_interface table in Steampipe provides you with information about Network Interfaces within AWS Elastic Compute Cloud (EC2). This table allows you, as a DevOps engineer, to query network interface-specific details, including the attached instances, associated security groups, subnet information, and more. You can utilize this table to gather insights on network interfaces, such as their status, type, private and public IP addresses, and the associated subnet and VPC details. The schema outlines for you the various attributes of the EC2 network interface, including the interface ID, description, owner ID, availability zone, and associated tags.

Examples

Basic IP address info

Determine the areas in which your AWS EC2 network interfaces are operating by exploring the type of interface, its corresponding private and public IP addresses, and its MAC address. This can be particularly useful for managing network connectivity and troubleshooting network issues within your AWS environment.

select
network_interface_id,
interface_type,
description,
private_ip_address,
association_public_ip,
mac_address
from
aws_ec2_network_interface;
select
network_interface_id,
interface_type,
description,
private_ip_address,
association_public_ip,
mac_address
from
aws_ec2_network_interface;

Find all ENIs with private IPs that are in a given subnet (10.66.0.0/16)

Discover the segments that have private IPs within a specific subnet. This is useful for identifying network interfaces within a particular subnet, which can aid in network management and security assessment.

select
network_interface_id,
interface_type,
description,
private_ip_address,
association_public_ip,
mac_address
from
aws_ec2_network_interface
where
private_ip_address :: cidr << = '10.66.0.0/16';
Error: SQLite does not support CIDR operations.

Count of ENIs by interface type

Discover the segments that have the most network interfaces in your AWS EC2 environment, helping you understand your network configuration and potentially optimize resource allocation.

select
interface_type,
count(interface_type) as count
from
aws_ec2_network_interface
group by
interface_type
order by
count desc;
select
interface_type,
count(interface_type) as count
from
aws_ec2_network_interface
group by
interface_type
order by
count desc;

Security groups attached to each ENI

Determine the areas in which certain security groups are attached to each network interface within your Amazon EC2 instances. This can help in managing security and access controls effectively.

select
network_interface_id as eni,
sg ->> 'GroupId' as "security group id",
sg ->> 'GroupName' as "security group name"
from
aws_ec2_network_interface
cross join jsonb_array_elements(groups) as sg
order by
eni;
select
network_interface_id as eni,
json_extract(sg, '$.GroupId') as "security group id",
json_extract(sg, '$.GroupName') as "security group name"
from
(
select
network_interface_id,
json_each.value as sg
from
aws_ec2_network_interface,
json_each(groups)
)
order by
eni;

Get network details for each ENI

Discover the segments that are common between your network interfaces and virtual private clouds (VPCs) to better understand your network structure. This can assist in identifying areas for potential consolidation or optimization.

select
e.network_interface_id,
v.vpc_id,
v.is_default,
v.cidr_block,
v.state,
v.account_id,
v.region
from
aws_ec2_network_interface e,
aws_vpc v
where
e.vpc_id = v.vpc_id;
select
e.network_interface_id,
v.vpc_id,
v.is_default,
v.cidr_block,
v.state,
v.account_id,
v.region
from
aws_ec2_network_interface e
join aws_vpc v on e.vpc_id = v.vpc_id;

Schema for aws_ec2_network_interface

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The AWS Account ID in which the resource is located.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
association_allocation_idtext=Allocation id for the association. Association can be an Elastic IP address (IPv4 only), or a Carrier IP address.
association_carrier_ipinetThe carrier IP address associated with the network interface.
association_customer_owned_ipinetThe customer-owned IP address associated with the network interface.
association_idtext=The association ID.
association_ip_owner_idtext=The ID of the Elastic IP address owner.
association_public_dns_nametext=The public DNS name of the association.
association_public_ipinet=The address of the Elastic IP address bound to the network interface.
attached_instance_idtext=The ID of the attached instance.
attached_instance_owner_idtext=The AWS account ID of the owner of the attached instance.
attachment_idtext=The ID of the network interface attachment.
attachment_statustext=The attachment state.
attachment_timetimestamp with time zone=The timestamp indicating when the attachment initiated.
availability_zonetext=The Availability Zone.
connection_tracking_configurationjsonbA security group connection tracking configuration that enables you to set the timeout for connection tracking on an Elastic network interface.
delete_on_instance_terminationboolean=, !=Indicates whether the network interface is deleted when the instance is terminated.
deny_all_igw_trafficbooleanIndicates whether a network interface with an IPv6 address is unreachable from the public internet.
descriptiontext=A description.
device_indexbigintThe device index of the network interface attachment on the instance.
groupsjsonbAny security groups for the network interface.
interface_typetextThe type of network interface.
ipv4_prefixesjsonbThe IPv4 prefixes associated with the network interface.
ipv6_addresstextThe IPv6 globally unique address associated with the network interface.
ipv6_addressesjsonbThe IPv6 addresses associated with the network interface.
ipv6_nativebooleanIndicates whether this is an IPv6 only network interface.
ipv6_prefixesjsonbThe IPv6 prefixes that are assigned to the network interface.
mac_addresstext=The MAC address of the interface.
network_interface_idtext=The ID of the network interface.
outpost_arntextThe Amazon Resource Name (ARN) of the Outpost, if applicable.
owner_idtext=The AWS account ID of the owner of the network interface.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
private_dns_nametext=The private DNS name
private_ip_addressinet=The IPv4 address of the network interface within the subnet.
private_ip_addressesjsonbThe IPv4 address of the network interface within the subnet.
regiontextThe AWS Region in which the resource is located.
requester_idtext=The ID of the entity that launched the instance on your behalf (for example, AWS Management Console or Auto Scaling).
requester_managedboolean=, !=Indicates whether the network interface is being managed by AWS.
source_dest_checkboolean=, !=Indicates whether traffic to or from the instance is validated.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statustext=The status of the network interface.
subnet_idtextThe ID of the subnet.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA list of tags that are attached to the network interface.
titletextTitle of the resource.
vpc_idtextThe ID of the VPC.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws

You can pass the configuration to the command with the --config argument:

steampipe_export_aws --config '<your_config>' aws_ec2_network_interface