Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadBalancerV2 target groups: include port and protocol to EC2Instance #1278

Merged
merged 5 commits into from
Dec 1, 2023

Conversation

heryxpc
Copy link
Contributor

@heryxpc heryxpc commented Nov 29, 2023

AWS api exposes a port and protocol per TargetGroup (see https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_TargetGroup.html)

Using those values to identify which EC2 instances are exposed by which protocols and ports based on LoadBalancer configuration.

@@ -159,6 +159,7 @@ def load_load_balancer_v2_target_groups(
MERGE (elbv2)-[r:EXPOSE]->(instance)
ON CREATE SET r.firstseen = timestamp()
SET r.lastupdated = $update_tag
r.port = $PORT, r.protocol = $PROTOCOL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed a comma. Needs to be

    SET r.lastupdated = $update_tag,
        r.port = $PORT, r.protocol = $PROTOCOL

Also, is the ARN of the target group available? If so, maybe we should include the ARN of the target group as r.target_group_arn so that it's easily searchable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh also let's remember to update the schema doc

@heryxpc heryxpc marked this pull request as ready for review November 29, 2023 20:29
ON CREATE SET r.firstseen = timestamp()
SET r.lastupdated = $update_tag
ON CREATE SET r.firstseen = timestamp(),
r.target_group_arn = $TARGET_GROUP_ARN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for the target_group_arn to change? To be safe, let's move this to the SET clause.

@achantavy achantavy changed the title Add exposed port and protocol from LoadBalancerV2 to EC2Instance if exists LoadBalancerV2 target groups: include port and protocol to EC2Instance Dec 1, 2023
@achantavy achantavy merged commit 86c7937 into master Dec 1, 2023
5 checks passed
@achantavy achantavy deleted the elbv2-targetgroup-port branch December 1, 2023 20:42
chandanchowdhury pushed a commit to juju4/cartography that referenced this pull request Jun 26, 2024
lyft#1278)

AWS api exposes a port and protocol per TargetGroup (see
https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_TargetGroup.html)

Using those values to identify which EC2 instances are exposed by which
protocols and ports based on LoadBalancer configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants