如何强制删除网络接口? AWS - 分离网络接口时出错
How force remove network interfaces? AWS - Error detaching network interface
我创建了带有嵌套堆栈的堆栈,其中有一些网络接口、VPC 等。
我尝试删除网络接口,但我做不到,因为我遇到了错误
Error detaching network interface
eni-0d3be6d4c7869686a: You are not allowed to manage 'ela-attach' attachments.
你知道如何强制删除吗?
找到弹性网卡绑定的资源。例如,它可以是 Lambda 函数或 ELB。该资源是在您的 CloudFormation 堆栈之外创建的吗?如果是这样,您将需要删除该资源。如果它是在 CloudFormation 堆栈中创建的,那么您可能只需要等待并重试(例如,如果热 Lambda 函数一直在 ENI 上)。
更详细地描述了步骤 here. Other ideas here。
我在使用多个 CF 堆栈时遇到了同样的问题。
当有正在使用的 AWS 构造附加到 VPC 时,堆栈删除失败。一种对我有用的方法是使用以下脚本查找依赖项,然后在删除 VPC 之前手动删除它们。 (手动删除脚本中的所有依赖项,最后尝试删除网络接口)。完成后,然后尝试从 mgmt 控制台删除 CF 堆栈,这没有任何问题。
让我们知道这是否有效。
#!/bin/bash
vpc="vpc-xxxxxxxxxxxxx"
aws ec2 describe-internet-gateways --filters 'Name=attachment.vpc-id,Values='$vpc | grep InternetGatewayId
aws ec2 describe-subnets --filters 'Name=vpc-id,Values='$vpc | grep SubnetId
aws ec2 describe-route-tables --filters 'Name=vpc-id,Values='$vpc | grep RouteTableId
aws ec2 describe-network-acls --filters 'Name=vpc-id,Values='$vpc | grep NetworkAclId
aws ec2 describe-vpc-peering-connections --filters 'Name=requester-vpc-info.vpc-id,Values='$vpc | grep VpcPeeringConnectionId
aws ec2 describe-vpc-endpoints --filters 'Name=vpc-id,Values='$vpc | grep VpcEndpointId
aws ec2 describe-nat-gateways --filter 'Name=vpc-id,Values='$vpc | grep NatGatewayId
aws ec2 describe-security-groups --filters 'Name=vpc-id,Values='$vpc | grep GroupId
aws ec2 describe-instances --filters 'Name=vpc-id,Values='$vpc | grep InstanceId
aws ec2 describe-vpn-connections --filters 'Name=vpc-id,Values='$vpc | grep VpnConnectionId
aws ec2 describe-vpn-gateways --filters 'Name=attachment.vpc-id,Values='$vpc | grep VpnGatewayId
aws ec2 describe-network-interfaces --filters 'Name=vpc-id,Values='$vpc | grep NetworkInterfaceId
参考:https://aws.amazon.com/premiumsupport/knowledge-center/troubleshoot-dependency-error-delete-vpc/
我创建了带有嵌套堆栈的堆栈,其中有一些网络接口、VPC 等。 我尝试删除网络接口,但我做不到,因为我遇到了错误
Error detaching network interface
eni-0d3be6d4c7869686a: You are not allowed to manage 'ela-attach' attachments.
你知道如何强制删除吗?
找到弹性网卡绑定的资源。例如,它可以是 Lambda 函数或 ELB。该资源是在您的 CloudFormation 堆栈之外创建的吗?如果是这样,您将需要删除该资源。如果它是在 CloudFormation 堆栈中创建的,那么您可能只需要等待并重试(例如,如果热 Lambda 函数一直在 ENI 上)。
更详细地描述了步骤 here. Other ideas here。
我在使用多个 CF 堆栈时遇到了同样的问题。 当有正在使用的 AWS 构造附加到 VPC 时,堆栈删除失败。一种对我有用的方法是使用以下脚本查找依赖项,然后在删除 VPC 之前手动删除它们。 (手动删除脚本中的所有依赖项,最后尝试删除网络接口)。完成后,然后尝试从 mgmt 控制台删除 CF 堆栈,这没有任何问题。
让我们知道这是否有效。
#!/bin/bash
vpc="vpc-xxxxxxxxxxxxx"
aws ec2 describe-internet-gateways --filters 'Name=attachment.vpc-id,Values='$vpc | grep InternetGatewayId
aws ec2 describe-subnets --filters 'Name=vpc-id,Values='$vpc | grep SubnetId
aws ec2 describe-route-tables --filters 'Name=vpc-id,Values='$vpc | grep RouteTableId
aws ec2 describe-network-acls --filters 'Name=vpc-id,Values='$vpc | grep NetworkAclId
aws ec2 describe-vpc-peering-connections --filters 'Name=requester-vpc-info.vpc-id,Values='$vpc | grep VpcPeeringConnectionId
aws ec2 describe-vpc-endpoints --filters 'Name=vpc-id,Values='$vpc | grep VpcEndpointId
aws ec2 describe-nat-gateways --filter 'Name=vpc-id,Values='$vpc | grep NatGatewayId
aws ec2 describe-security-groups --filters 'Name=vpc-id,Values='$vpc | grep GroupId
aws ec2 describe-instances --filters 'Name=vpc-id,Values='$vpc | grep InstanceId
aws ec2 describe-vpn-connections --filters 'Name=vpc-id,Values='$vpc | grep VpnConnectionId
aws ec2 describe-vpn-gateways --filters 'Name=attachment.vpc-id,Values='$vpc | grep VpnGatewayId
aws ec2 describe-network-interfaces --filters 'Name=vpc-id,Values='$vpc | grep NetworkInterfaceId
参考:https://aws.amazon.com/premiumsupport/knowledge-center/troubleshoot-dependency-error-delete-vpc/