Skip to content

EreminAnton/aws-eni-identifier

 
 

Repository files navigation

FivexL

AWS ENI Identifier

Identify to which AWS service network interface is associated

aws-eni-identifier-cli.png

Installation

pip install aws-eni-identifier

Usage

aws-eni-identifier does not connect to AWS by itself, so you will need to load data with aws-cli

Login to aws:

aws sso login --profile my-profile

Use pipe:

aws ec2 describe-network-interfaces | aws-eni-identifier

Or save to file with aws-cli and read it:

aws ec2 describe-network-interfaces > ni.json
aws-eni-identifier -i ni.json

Show extra columns

aws ec2 describe-network-interfaces | 
aws-eni-identifier \
    --add-column Attachment.Status \
    --add-column AvailabilityZone

extra-columns.png

Filter

Find unused network interfaces:

aws ec2 describe-network-interfaces \
    --filters "Name=status,Values=available" |
aws-eni-identifier

Find AWS resource by IP address (you can use public or private IP address)

export IP='51.21.223.193';
aws ec2 describe-network-interfaces \
    --query "NetworkInterfaces[?PrivateIpAddresses[?PrivateIpAddress=='${IP}' || Association.PublicIp=='${IP}']]" | 
aws-eni-identifier

Determine what is using specific AWS network interface

aws ec2 describe-network-interfaces \
    --network-interface-ids eni-0068ac3f8786de59a | 
aws-eni-identifier

You can find more information about filters and queries in AWS documentation

Developing

Install the package:

poetry install

Run tests:

poetry run pytest

About

Identify to which AWS service network interface is associated

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%