Sha256: db0aaf6d61a23f46e40c7c926889312187c5ebbfb663432d3762c7c263285b49
Contents?: true
Size: 1021 Bytes
Versions: 10
Compression:
Stored size: 1021 Bytes
Contents
module Stackster class InstanceReader def initialize(args) @config = args[:config] end # Data structure is return deffernelty for class # ToDo - Add support for classic # Currently only supports VPC def list_stack_instances(stack_name) h = [] describe_instances.each do |instance| tag_set = instance['instancesSet'].first['tagSet'] instance_stack_name = tag_set['aws:cloudformation:stack-name'] if instance_stack_name && instance_stack_name == stack_name if instance_running? instance h << instance end end end h end private def ec2 @ec2 ||= AWS::EC2.new :config => @config end def get_instance_state(instance_hash) instance_hash['instancesSet'].first['instanceState']['name'] end def instance_running?(instance_hash) get_instance_state(instance_hash) == 'running' end def describe_instances ec2.describe_instances end end end
Version data entries
10 entries across 10 versions & 1 rubygems