Last active
August 29, 2015 13:57
-
-
Save pbogunovich/9792087 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Current implementation (Broken). | |
# Doesn't ensure that the tag value of 'aws:autoscaling:groupName' | |
# is actually the name of the autoscaling group | |
def ec2_instances | |
instances = EC2::InstanceCollection.new(:config => config) | |
instances.tagged('aws:autoscaling:groupName').tagged_values(name) | |
end | |
# Proposed fix. Works but is really slow. | |
def fixed_but_inefficient_ec2_instances | |
instances = EC2::InstanceCollection.new(:config => config) | |
instances.tagged('aws:autoscaling:groupName').find_all do |i| | |
name == i.tags['aws:autoscaling:groupName'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment