get ec2 instances with a certain tag using aws sdk

Question:

I am trying to figure out what is the best way to get a list of ec2 instances with a certain tag for example “testing” using the ruby aws sdk.

This does not seem to work for some reason. It was thinking it will filter out the collection and just give me instances with tag testing. Is there a way to do this using the ruby sdk? thank you.

Answer:

If you want the tag “Name” with the value of “testing” use:

For all instances with a tag key of “testing” the following is used.

See the #instances docs for more filter options.

Leave a Reply