Skip to content

Instantly share code, notes, and snippets.

@fredjean
Created August 16, 2012 16:43
Show Gist options
  • Save fredjean/3371564 to your computer and use it in GitHub Desktop.
Save fredjean/3371564 to your computer and use it in GitHub Desktop.
require 'right_aws'
def instances_from_ec2(load_balancer = nil)
load_balancer ||= aws_load_balancer
payload = elb.describe_load_balancers(load_balancer)
instances = ec2.describe_instances payload.first[:instances]
instances.collect{|instance| instance[:dns_name] if (instance[:aws_state] == 'running')}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment