I am fairly new to AWS CLI. I am trying to find out the limit(quota) of elastic IP addresses for a region(e.g. us-east-1). From that limit, how many have been used and how many are remaining for my terraform script to use. I need to use this to conditionalise the further flow. Need help. Right now I have tried to use the below but it gives me wrong answer.
Available_Elastic_IPs=$(AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN aws ec2 describe-addresses --query "Addresses[?NetworkInterfaceId == null ].PublicIp" --region "$REGION" --output "text" | wc -w)
This tells me where the network interface ID are null. Even if the count is 0, I can still go ahead and create EC2 instances with elastic IPs. So I think the query needs slight adjustment.