This is happening because the EIP is associated with the managed network interface of the load balancer. It takes some time for the deleted NLB to release the network interface. You cant delete the EIP until the network interface is gone, and unfortunately CloudFormation doesnt have any knowledge of this.
You can do any of the following:
- Dont use an Elastic IP and just let AWS assign a public IP to the NLB. Example:
loadBalancer: Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer' Properties: Type: network IpAddressType: ipv4 Scheme: internet-facing Subnets: !Ref Subnets
- Perform a delete-stack operation again, after verifying that any network interfaces(belonging to network load balancer) are deleted by elbv2 service itself and association id is removed from EIP.
- Use DeletionPolicy/UpdateReplacePolicy attributes with AWS::EC2::EIP resource and set value to Retain to achieve single step stack deletion. Note that you will still need to delete the EIP manually.
NLB Static IP QuestionAccepted Answerasked 3 years ago
Restricting incoming NLB traffic to internal IP addressesAccepted Answerasked 2 years ago
using of NLB for HAasked 2 months ago
NLB Preserving Client IPAccepted Answerasked 2 years ago
Load Balancer [NLB] - Listeners - Inconsistentasked 8 months ago
NLB Distribution unevenly with wildfly and pgBouncerasked 7 months ago
CloudFormation deleting nlb did not release public IPasked 16 days ago
Static IP for NLB endpointAccepted Answerasked 2 years ago
NLB stops responding on one IPAccepted Answerasked 2 years ago
NLB-ECS Health CheckAccepted Answerasked 2 years ago