Skip to content

Instantly share code, notes, and snippets.

@hirobert
hirobert / aws-load-balancer-elb-alb-target-group-target-currently-in-use-by-a-listener-or-a-rule.md
Last active August 25, 2022 22:58
aws load balancer (elb/alb) target group - target currently in use by a listener or a rule

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
// adapted from https://github.com/KaneQc/Noun-Project-API/blob/master/NounProjectAPI.cs
using RestSharp;
using RestSharp.Authenticators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Request
var OAuth = require('oauth')
// `npm install oauth` to satisfy
// website: https://github.com/ciaranj/node-oauth
var KEY = "<INSERT KEY HERE>"
var SECRET = "<INSERT SECRET HERE>"
var oauth = new OAuth.OAuth(
'http://api.thenounproject.com',
'http://api.thenounproject.com',
<?php
class OAuthException extends Exception
{
// pass
}
class OAuthConsumer
{
public $key;
@hirobert
hirobert / empty-rq-failed-queue.py
Created October 12, 2023 18:58
Fix Stuck Jobs in RQ Failed Queue
# If RQ thinks there are failed jobs
# but they do not exist in Redis
# and RQ-Dashboard cannot remove/requeue them
from redis import Redis
from rq import Queue
from rq.registry import FailedJobRegistry
from rq.exceptions import NoSuchJobError
redis_rq = Redis(host=REDIS_SERVER, port=6379, db=1)