无法分离或销毁通过 CloudFormation 脚本创建的 AWS 网络接口

Unable to detach or destroy AWS Network Interface created via CloudFormation script

最近我已经成功地创建和销毁了这个 AWS CloudFormation 堆栈 https://github.com/jacekdalkowski/aws-cf-eks-min/blob/main/eks-min.yaml,但是今天删除过程失败了,从那以后我无法清理它。

根据日志,删除时失败(按顺序):

  1. VpcGatewayAttachement
  2. 公共子网 2
  3. 互联网网关
  4. Vpc.

我试图手动删除这些,但似乎另一个资源 BastionHostSshNetworkInterfaceAWS::EC2::NetworkInterface 类型)实际上并未被销毁。

我无法分离也无法破坏界面。在我的 master/admin 帐户上尝试通过控制台(网页)分离界面时出现错误:

Failed to detach the network interface. API error: "You do not have permission to access the specified resource."

尝试通过 CLI 分离时:

aws ec2 detach-network-interface --attachment-id eni-attach-03e1... --force

我遇到了类似的错误:

An error occurred (AuthFailure) when calling the DetachNetworkInterface operation: You do not have permission to access the specified resource.

我尝试给自己制定各种政策,例如AWSNetworkManagerFullAccessAmazonEC2FullAccess.

如何授予我自己或我的 CLI 用户对特定网络接口的权限,以便我可以分离 and/or 销毁它?

所以问题是在删除堆栈之前我正在玩 Kubernetes 并设置服务。在 EKS 上设置服务会导致创建 Elastic Load Balancer。我在删除堆栈之前没有删除我的 Kubernetes 环境,ELB 被孤立但连接到 VPC 并阻止它被删除。