Amazon Web Services – Deleting Network Load Balancer
The AWS Network Load Balancer is used for routing the connections to other active microservices, containers, or instances of Amazon EC2 from the Amazon Virtual Private Cloud(VPC). These mappings (connections) are based on the IP protocol data. It operates on the connection level (Layer 4), for both TCP and UDP connections.
In this article, we will look into the possible reasons where deletion of the network load balancer in a virtual private cloud fails with the error indicating that the network load balancer is currently associated with another service. And we will also look into how we can fix it.
This message is generally encountered when you try to delete a network load balancer that is already associated with the VPC endpoint service. Note that this process is strictly related to changing the configuration of the resources. Implementing these changes will disrupt ongoing traffic (if any). Be sure you understand the effect that this disruption will have on your applications.
First we will attempt to delete the network load balancer that is associated with the VPC endpoint service. So log in to the AWS management console and navigate to the Amazon Elastic Compute Cloud console.
In the navigation panel choose load balancers.
Here we want to delete the network load balancer test1. So we’ll select this load balancer.
Now choose actions and select delete followed by yes delete to delete the load balancer.
As you can see we can’t delete the network load balancer because it’s associated with another service.
To confirm whether network load balancer is associated with an endpoint service and then to disassociate it follow the below steps:
Step 1: Navigate to the VPC console.
Step 2: On the navigation page choose Endpoint services.
Step 3: Then check the Load Balancers tab.
For each endpoint service as you can see our load balancer is associated with this service.
If you see that your load balancer is associated with an endpoint service then perform the following actions:
Step 4: Select the Endpoint Connections tab.
The endpoint connections tab lists the endpoint connections that are attached to your endpoint service.
Step 5: Select all the connections that are not in the rejected state.
Step 6: Choose actions and select Reject endpoint connection request, and then choose yes reject.
Step 7: After you do this for all the connections select the Load Balancer tab again.
Step 8: Choose Associate/Disassociate Load Balancers.
Step 9: Now deselect your network load balancer and choose to save after completing these actions.
Step 10: Now navigate back to the load balancer console to delete the network load balancer. We’ll select the network load balancer and then choose actions. Then select delete and then choose yes delete.
Now you can see that the Network Load Balancer is deleted without any issues.