turbot/alicloud
steampipe plugin install alicloud

Table: alicloud_ecs_network_interface - Query Alibaba Cloud Elastic Compute Service Network Interfaces using SQL

A Network Interface in Alibaba Cloud Elastic Compute Service (ECS) is a virtual network interface card (vNIC) that is attached to an instance. It provides the primary network connection for communication with network services and other instances. Each network interface is associated with a security group that controls the traffic to the instance.

Table Usage Guide

The alicloud_ecs_network_interface table provides insights into Network Interfaces within Alibaba Cloud Elastic Compute Service (ECS). As a network administrator or cloud engineer, explore network interface-specific details through this table, including its status, type, and associated security groups. Utilize it to uncover information about network interfaces, such as those with specific security groups, the status of each interface, and the type of network interface.

Examples

Basic ENI info

Explore the status and details of network interfaces within your Alicloud Elastic Compute Service. This can be useful to manage network configurations and troubleshoot connectivity issues.

select
network_interface_id,
type,
description,
status,
instance_id,
private_ip_address,
associated_public_ip_address,
mac_address
from
alicloud_ecs_network_interface;
select
network_interface_id,
type,
description,
status,
instance_id,
private_ip_address,
associated_public_ip_address,
mac_address
from
alicloud_ecs_network_interface;

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

Explore which Elastic Network Interfaces (ENIs) with private IPs fall within a specific subnet. This is particularly useful in understanding network configurations and managing resources within a particular network range.

select
network_interface_id,
type,
description,
private_ip_address,
associated_public_ip_address,
mac_address
from
alicloud_ecs_network_interface
where
private_ip_address << = '10.66.0.0/16';
Error: SQLite does not support CIDR operations.

Count of ENIs by interface type

Analyze the variety of network interfaces in use to understand their distribution within your Alicloud Elastic Compute Service (ECS). This is useful for gauging network capacity and planning for potential upgrades or changes.

select
type,
count(type) as count
from
alicloud_ecs_network_interface
group by
type
order by
count desc;
select
type,
count(type) as count
from
alicloud_ecs_network_interface
group by
type
order by
count desc;

Security groups attached to each ENI

Determine the areas in which security groups are associated with each Elastic Network Interface (ENI). This allows you to understand your network's security layout and identify potential vulnerabilities or areas for improvement.

select
network_interface_id as eni,
sg
from
alicloud_ecs_network_interface
cross join jsonb_array_elements(security_group_ids) as sg
order by
eni;
select
network_interface_id as eni,
sg.value as sg
from
alicloud_ecs_network_interface,
json_each(security_group_ids) as sg
order by
eni;

Find ENIs for a specific instance

Gain insights into the network interfaces associated with a specific instance, including their status, type, and IP addresses. This can be useful for troubleshooting connectivity issues or understanding the network configuration of a particular instance.

select
network_interface_id as eni,
instance_id,
status,
type,
description,
private_ip_address,
associated_public_ip_address,
mac_address
from
alicloud_ecs_network_interface
where
instance_id = 'i-0xi8u2s0ezl5auigem8t'
select
network_interface_id as eni,
instance_id,
status,
type,
description,
private_ip_address,
associated_public_ip_address,
mac_address
from
alicloud_ecs_network_interface
where
instance_id = 'i-0xi8u2s0ezl5auigem8t'

Schema for alicloud_ecs_network_interface

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextThe alicloud Account ID in which the resource is located.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
associated_public_ip_addressinetThe public IP address of the instance.
associated_public_ip_allocation_idtextThe allocation ID of the EIP.
attachmentjsonbAttachments of the ENI
creation_timetimestamp with time zoneThe time when the ENI was created.
descriptiontextThe description of the ENI.
instance_idtextThe ID of the instance to which the ENI is bound.
ipv6_setsjsonbThe IPv6 addresses assigned to the ENI.
mac_addresstextThe MAC address of the ENI.
nametextThe name of the ENI.
network_interface_idtext=An unique identifier for the ENI.
owner_idtextThe ID of the account that owns the ENI.
private_ip_addressinetThe private IP address of the ENI.
private_ip_setsjsonbThe private IP addresses of the ENI.
queue_numberbigintThe number of queues supported by the ENI.
regiontextThe Alicloud region in which the resource is located.
resource_group_idtextThe ID of the resource group to which the ENI belongs.
security_group_idsjsonbThe IDs of the security groups to which the ENI belongs.
service_idtextThe ID of the distributor to which the ENI belongs.
service_managedbooleanIndicates whether the user is an Alibaba Cloud service or a distributor.
statustextThe status of the ENI.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA list of tags attached with the resource.
titletextTitle of the resource.
typetextThe type of the ENI. Valid values: 'Primary' and 'Secondary'
vpc_idtextThe ID of the VPC to which the ENI belongs.
vswitch_idtextThe ID of the VSwitch to which the ENI is connected.
zone_idtextThe zone ID of the ENI.

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)" -- alicloud

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

steampipe_export_alicloud --config '<your_config>' alicloud_ecs_network_interface