I'm using these two AWS documentations to search network interfaces for their statuses. https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-network-interfaces.html https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-network-interface-attribute.html
It's very unclear though as to how to use --filters and --attribute. The documentation states I can use "status" to find the statues of each network interface, but I'm having difficulty.
I've tried:
aws ec2 describe-network-interfaces --network-interface-id [myNetworkID] --filters status
And received:
Error parsing parameter '--filters': Expected: '=', received: 'EOF' for input:
status
^
So I tried:
aws ec2 describe-network-interface-attribute --network-interface-id [myNetworkID} --attribute status
And received:
An error occurred (InvalidParameterValue) when calling the DescribeNetworkInterfaceAttribute operation: Value (status) for parameter attribute is invalid. Unknown attribute.
I've also tried:
aws ec2 describe-network-interface --network-interface-id [myNetworkID] --filters Name=Status,Values=*
aws ec2 describe-network-interface --network-interface-id [myNetworkID] --filters Name=tag-Status,Values=*
And of course I tried everything with double quotes, single quotes, and different wording per examples I could find online. I'm not sure how useful sharing all my unsuccessful attempts are, but if needed, I'm more than happy to share each one and the error associated with each.
Thank you in advance.
If you want to get the ENIs that are in-use only,
aws ec2 describe-network-interfaces --filters Name=status,Values=in-use
If you want to get a list of ENIs with ID and status only,
aws ec2 describe-network-interfaces --query 'NetworkInterfaces[*].{NetworkInterfaceId: NetworkInterfaceId, Status: Status}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With