[Solved] Community interface is in use by one other service in AWS


When you have tried to delete a Safety Group, or VPC, or numerous different assets and also you get the dreaded Community interface is in use by one other service error, then you’ll be able to resolve this by deleting the useful resource by the API.

Learn how to delete the Community Interface (ENI)

aws ec2 delete-network-interface --network-interface-id eni-xxxxx

Change the eni-xxxxx with the ENI id that you’re struggling to delete.

Learn how to discover what providers are utilizing the ENI

#!/bin/bash
vpc="vpc-xxxxxxxxxxxxx" 
aws ec2 describe-internet-gateways --filters 'Identify=attachment.vpc-id,Values='$vpc | grep InternetGatewayId
aws ec2 describe-subnets --filters 'Identify=vpc-id,Values='$vpc | grep SubnetId
aws ec2 describe-route-tables --filters 'Identify=vpc-id,Values='$vpc | grep RouteTableId
aws ec2 describe-network-acls --filters 'Identify=vpc-id,Values='$vpc | grep NetworkAclId
aws ec2 describe-vpc-peering-connections --filters 'Identify=requester-vpc-info.vpc-id,Values='$vpc | grep VpcPeeringConnectionId
aws ec2 describe-vpc-endpoints --filters 'Identify=vpc-id,Values='$vpc | grep VpcEndpointId
aws ec2 describe-nat-gateways --filter 'Identify=vpc-id,Values='$vpc | grep NatGatewayId
aws ec2 describe-security-groups --filters 'Identify=vpc-id,Values='$vpc | grep GroupId
aws ec2 describe-instances --filters 'Identify=vpc-id,Values='$vpc | grep InstanceId
aws ec2 describe-vpn-connections --filters 'Identify=vpc-id,Values='$vpc | grep VpnConnectionId
aws ec2 describe-vpn-gateways --filters 'Identify=attachment.vpc-id,Values='$vpc | grep VpnGatewayId
aws ec2 describe-network-interfaces --filters 'Identify=vpc-id,Values='$vpc | grep NetworkInterfaceId
See also  Create a MySQL Desk in Python

Leave a Reply