When starting a new account, Amazon creates a new default VPC with 3 subnets, 1 security group, 1 ACL and 1 internet gateway. I want to delete the default vpc and objects associated with. I can do this via the console but I want to achieve this via the aws cli and I'm stucked.
When I try the following command :
aws ec2 delete-vpc --vpc-id $VpcId The console returns a DependencyViolation error :
A client error (DependencyViolation) occurred when calling the DeleteVpc operation: The vpc 'vpc-13f53076' has dependencies and cannot be deleted.
So I tried to delete dependencies but it doesn't works for all !
For the internet gateway, I got the same error :
A client error (DependencyViolation) occurred when calling the DeleteInternetGateway operation: The internetGateway 'igw-d0f51bb5' has dependencies and cannot be deleted.
For the default security group. I got the following error :
A client error (CannotDelete) occurred when calling the DeleteSecurityGroup operation: the specified group: "sg-acca7bc " name: "default" cannot be deleted by a user
For the default ACL, I got the following error :
A client error (InvalidParameterValue) occurred when calling the DeleteNetworkAcl operation: cannot delete default network ACL acl-d3ba77b6
This is a new account without anything created before excepted the default vpc created by Amazon. Any help or pointers in the right direction would be much appreciated.