Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save hirobert/f8e677d6160250e5d953712938812cb6 to your computer and use it in GitHub Desktop.

Select an option

Save hirobert/f8e677d6160250e5d953712938812cb6 to your computer and use it in GitHub Desktop.

Revisions

  1. hirobert renamed this gist Aug 25, 2022. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,6 @@ Here is another approach:
    3. `aws elbv2 describe-load-balancer`, get the load balancer arn
    4. `aws elbv2 describe-listeners --load-balancer-arn arn:aws:elasticloadbalancing:this_is_the_load_balancer_arn`, get listener arn for the listener which you associated with the target group
    5. `aws elbv2 describe-rules --listener-arn arn:aws:elasticloadbalancing:this_is_the_listener_arn`, get the rule arn which should contain the name of the target group you are looking to remove
    6. `aws elbv2 delete-rule --rule-arn arn:aws:elasticloadbalancing:this_is_the_rule_arn
    6. `aws elbv2 delete-rule --rule-arn arn:aws:elasticloadbalancing:this_is_the_rule_arn`

    You should now be able to return to the AWS console and successfully delete the target group as it is no longer associated with the load balancer.
  2. hirobert created this gist Aug 25, 2022.
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    This is likely happening because there are still rules associated with the load balancer that are using the target group.
    Unfortunately there is currently on way in the AWS console to view or edit the rules.
    Here is another approach:

    1. Install AWS cli: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
    2. If you have different profiles, add `--profile=name_of_profile` on each of the following commands
    3. `aws elbv2 describe-load-balancer`, get the load balancer arn
    4. `aws elbv2 describe-listeners --load-balancer-arn arn:aws:elasticloadbalancing:this_is_the_load_balancer_arn`, get listener arn for the listener which you associated with the target group
    5. `aws elbv2 describe-rules --listener-arn arn:aws:elasticloadbalancing:this_is_the_listener_arn`, get the rule arn which should contain the name of the target group you are looking to remove
    6. `aws elbv2 delete-rule --rule-arn arn:aws:elasticloadbalancing:this_is_the_rule_arn

    You should now be able to return to the AWS console and successfully delete the target group as it is no longer associated with the load balancer.