-1

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

gdix0n
  • 214
  • 3
  • 13
  • Can you possibly Edit your question to show us an example of the Output you are seeking, with an explanation of each column? – John Rotenstein Jul 21 '21 at 07:28
  • it doesn't need to be a table I just want to be able to get the Name of the NACL from the tag and count the number of entries in the NACL, happy with whatever output i can get – gdix0n Jul 21 '21 at 10:58

1 Answers1

1

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.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470