Failing with dependency violation
I have tried to delete VPC, and it is able to delete through UI also.
But when ran with this sh file. Got below error.
./delete_vpc.sh us-west-2 vpc-0f904ff05c1a26ffc
An error occurred (DependencyViolation) when calling the DeleteSecurityGroup operation: resource sg-0063528210d054afa has a dependent object
complete output:
*** Are you sure to delete the VPC of vpc-0f904ff05c1a26ffc in us-west-2 (y/n)? y
Process of ELB ...
Process of EC2 instance(s) ...
Process of NAT Gateway ...
delete NAT Gateway of nat-05de65442a5014405
waiting for state of deleted
Process of VPN connection ...
Process of VPN Gateway ...
Process of VPC Peering ...
Process of VPC endpoints ...
delete endpoint of vpce-0b83f34a69148f5e6
Process of Egress Only Internet Gateway ...
Process of Network ACLs ...
Process of Elastic IP ...
Process of Network Interface ...
Process of Security Group ...
delete Security group of sg-0063528210d054afa
An error occurred (DependencyViolation) when calling the DeleteSecurityGroup operation: resource sg-0063528210d054afa has a dependent object
Could you figure out the dependency ? Which object has adopted this SG?
@lianghong I had the same problem and I solved it here, when we are deleting a security group that has an inbound or outbound rule referring to another security group we have this problem, the solution found was to remove all the inbound and outbound rules and then remove the security group
This may be caused by Ingress and Egress policy in SG, try the new version