Method: Awspec::Type::AlbTargetGroup#has_ec2?

Defined in:
lib/awspec/type/alb_target_group.rb

#has_ec2?(id) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
# File 'lib/awspec/type/alb_target_group.rb', line 11

def has_ec2?(id)
  ec2 = find_ec2(id)
  return nil unless ec2
  descriptions = elbv2_client.describe_target_health(
    target_group_arn: resource_via_client.target_group_arn
  ).target_health_descriptions
  descriptions.find do |description|
    description.target.id == ec2.instance_id
  end
end