Unable to filter by tags

29 views
Skip to first unread message

John Dyer

unread,
Aug 5, 2014, 5:38:20 PM8/5/14
to go...@googlegroups.com
Hello,

 I am trying to filter instances by tags but its not working, I am getting nothing when I actually use the filter

func main() {

auth := aws.Auth{AccessKey: "xxxx", SecretKey: "xxxxxx"}
e := ec2.New(auth, aws.USEast)

filter := ec2.NewFilter()
filter.Add("backup_devices", "all")

resp, _ := e.DescribeInstances(nil, filter)
fmt.Println(resp)

}


Any idea what I am doing wrong?  Thanks in advance ! 

-John

Lyndsay Roger

unread,
Aug 6, 2014, 6:29:31 AM8/6/14
to go...@googlegroups.com

Are you sure the "backup_devices" is correct?

An example I have filter.Add("tag-key", "autobkup") which filters on tag keys.

tag-key is one of the available filter options. Have a look at this page -
http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html

John Dyer

unread,
Aug 6, 2014, 4:53:39 PM8/6/14
to go...@googlegroups.com
That was it, I should have been doing 

filter.Add("tag-key", "backup_devices", "all")

Thanks!

ureal frank

unread,
Jan 28, 2015, 8:21:05 PM1/28/15
to go...@googlegroups.com
Hi guys,

How about this one?

tag:key=value - The key/value combination of a tag assigned to the resource, where tag:key is the tag's key."

I've tried without success this:

"...
    filter := ec2.NewFilter()
    filter.Add("tag:", tagKey, tagValue) 
..."

any tip on this?

Cheers,
Frank
Reply all
Reply to author
Forward
0 new messages