Class: AWS::EC2::Base
- Inherits:
-
Object
- Object
- AWS::EC2::Base
- Defined in:
- lib/ec2-instance.rb
Instance Method Summary collapse
-
#active_instances ⇒ Object
Returns an array of instance ids which have a running or pending status.
-
#active_instances_with_tag(tag) ⇒ Object
Return a list of active instances which have a tag value which regexp matches.
-
#identity_instance ⇒ Object
Return an instance object for this machine.
-
#launch_time ⇒ Object
Deprecated.
Instance Method Details
#active_instances ⇒ Object
Returns an array of instance ids which have a running or pending status
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ec2-instance.rb', line 14 def active_instances instances = [] parse_instance_set(self.describe_instances).each do |instance| if instance.status == "running" || instance.status == "pending" instances.push instance end end return instances end |
#active_instances_with_tag(tag) ⇒ Object
Return a list of active instances which have a tag value which regexp matches.
29 30 31 32 33 34 35 |
# File 'lib/ec2-instance.rb', line 29 def active_instances_with_tag(tag) matches = [] active_instances.each do |ai| matches.push ai unless !ai.match?(tag) end return matches end |
#identity_instance ⇒ Object
Return an instance object for this machine.
40 41 42 43 44 45 |
# File 'lib/ec2-instance.rb', line 40 def identity_instance local_instance = parse_instance_set(self.describe_instances).detect do |inst| inst.instance_id.eql? AWS::EC2::Instance.local_instance_id end return local_instance end |
#launch_time ⇒ Object
Deprecated. Will be removed in the next couple versions.
Please use identity_instance.launch_time
51 52 53 |
# File 'lib/ec2-instance.rb', line 51 def launch_time identity_instance.launch_time end |