AWS CLI to calculate the number of NACL rules per NACL

197 views Asked by At

I am trying to find a quick way to calculate the number of NACL rules per NACL using the aws cli. I was hoping to display it as a table with the name tag on the left column and the number of NACLs on the right column. Does anyone know if this is possible?

If not possible even the output of the name of the NACL with the number of rules per NACL would be perfect

1

There are 1 answers

0
John Rotenstein On BEST ANSWER

You can use:

aws ec2 describe-network-acls --query 'NetworkAcls[].[NetworkAclId,Tags[?Key==`Name`]|[0].Value,length(Entries)]' --output text

This works on my Mac. Sometimes you need to play with the quote characters, depending upon your Operating System.

It outputs the ID, the Value of the tag with a Key of 'Name', and the number of Entries that are in that NACL.