Class: AwsClient::Ec2Wrapper

Inherits:
Wrapper
  • Object
show all
Defined in:
lib/ec2_wrapper.rb

Instance Attribute Summary

Attributes inherited from Wrapper

#client

Instance Method Summary collapse

Methods inherited from Wrapper

#initialize

Constructor Details

This class inherits a constructor from AwsClient::Wrapper

Instance Method Details

#cloudformation_resource_for_server(node_name) ⇒ Object



14
15
16
# File 'lib/ec2_wrapper.rb', line 14

def cloudformation_resource_for_server(node_name)
  return CLIENTS.cloudformation.ec2_server_stack_resource_for_node_name(BOOT_CONFIG.cf_stack_name, node_name)
end

#ec2_instance_public_address(node_name) ⇒ Object



4
5
6
# File 'lib/ec2_wrapper.rb', line 4

def ec2_instance_public_address(node_name)
  return ec2_instance_via_cloudformation_lookup(node_name).public_ip_address
end

#ec2_instance_via_cloudformation_lookup(node_name) ⇒ Object



8
9
10
11
12
# File 'lib/ec2_wrapper.rb', line 8

def ec2_instance_via_cloudformation_lookup(node_name)
  instance = cloudformation_resource_for_server(node_name).first
  instances_result = client.describe_instances(filters: [{name:'instance-id', values:[instance.physical_resource_id]}])
  return instances_result.reservations[0].instances[0]
end