module AwsClient class Ec2Wrapper < AwsClient::Wrapper def ec2_instance_public_address(node_name) return ec2_instance_via_cloudformation_lookup(node_name).public_ip_address end 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 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 end end