agentcore destroy 後の VPC 削除で DependencyViolation が出たら ENI の解放を待つ
AgentCore Runtime の WebRTC エージェントを検証した後、agentcore destroy で削除してから VPC をクリーンアップしようとしたら DependencyViolation で止まった。
An error occurred (DependencyViolation) when calling the DeleteSubnet operation:
The subnet 'subnet-xxx' has dependencies and cannot be deleted.原因は AgentCore Runtime が VPC のプライベートサブネットに作成した ENI だ。describe-network-interfaces で確認すると in-use、InstanceOwnerId が amazon-aws で、手動デタッチも OperationNotPermitted で拒否される。
結局、ENI が available に変わるまで待つしかなかった。今回のケースでは agentcore destroy から約9時間後に解放された。解放後は delete-network-interface → delete-subnet → delete-vpc の順で削除できた。
Lambda の VPC ENI でも同様の挙動があるが、AgentCore Runtime の場合はサービスリンクロール(AWSServiceRoleForBedrockAgentCoreNetwork)が管理しているため、ロールの削除を先に行うと解放が早まる可能性がある。
