Closed dandunckelman closed 9 years ago
To apply filters, you pass an array of hashes. Valid hash keys are :name
, and :key
. The filter :name
is one of the filters documented here (click the request parameters tag for the valid filter list): http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Client.html#describe_instances-instance_method
To filter by a tag name and value pair, its a bit tricky, because the filter name is the string "tag:#{tag_name}". For example:
ec2 = Aws::EC2::Resource.new
instances = ec2.instances(filters: [{ name: 'tag:app_type', values:['spark'])
Hope this helps!
This may be a silly question, but I can't seem to figure out how to do this from the instructions in the documentation.
Here's what I'm trying:
With variations like this:
Everytime I try to iterate on the collection of
instances
, I get errors like this:Thanks for the help.