Reputation: 430
How to get list of all private Ip's of AWS instances except few tags from AWS CLI?
I can get all IP from below command
aws ec2 describe-instances --query "Reservations[].Instances[][PrivateIpAddress]"
I want to exclude IP's from tag "webinstance" & "frontendinstances" How to use filter for this.
aws ec2 describe-instances --filters "Name=tag:stack-name,Values=webinstance" --query 'Reservations[].Instances[].[PrivateIpAddress]'
From above I get Ip's related to that specific tag, but dont know how to exclude it.
Upvotes: 0
Views: 149
Reputation: 2943
EC2 Describe Instances API does not support exclusions in filters.
You might be able to achieve the result using some bash scripts using below approach:
Upvotes: 1