donnemartin / saws

A supercharged AWS command line interface (CLI).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

saws is great, but how to list the IP address with tag value of "*prod*"

ozbillwang opened this issue · comments

I have several ec2 instances with tag as:

 # format is APP[Number]-ENV, such as lb01-stag, web02-prod, etc.
 Name: lb01-prod 

So I like to list all production instances IP address only, how to prepare the command? Output should be Name and IP.

 aws ec2 ls --ec2-tag-value ...   ???

Hi @SydOps, thanks for the feedback.

You can pipe the output to another command such as grep:

saws> aws ec2 ls --ec2-tag-key TAGKEY | grep 'PublicIp\|PrivateIpAddress\|InstanceId'
                    "InstanceId": "i-FOOOBARR",
                    "PrivateIpAddress": "w.x.y.z",
                            "PrivateIpAddress": "w.x.y.z",