This Python script attempts to delete the AWS default VPC in each region.
Requirements:
- Tested with:
- Python version: 3.8.1
- Boto3 version: 1.18.29
- Botocore version: 1.21.29
- Valid AWS API keys/profile
Usage:
If using aws_okta_keyman, your default AWS CLI profile will be overwritten with the current session. If using an authentication method other than aws_okta_keyman, you may need to pass in a specific profile using the -p flag. The script will use your default profile if the -p flag is omitted.
python remove_default_vpc.py
You are logged in as arn:aws:sts::<ACCOUNT_ID>:assumed-role/<ROLE_NAME>/<SESSION_NAME>
If the above user/account are correct, enter 'yes' to attempt to delete resources: yes
Output:
2021-08-26 15:58:14 WARNING VPC vpc-ddacdca0 has existing network interfaces in the us-east-1 region and will be skipped.
2021-08-26 15:58:15 WARNING No Subnets found in vpc-f2880199
2021-08-26 15:58:15 WARNING Deleting launch wizard security group: launch-wizard-3 sg-066cfefce69c82a6c in VPC: vpc-f2880199
2021-08-26 15:58:16 WARNING Deleting launch wizard security group: launch-wizard-1 sg-0727d511a2783f71d in VPC: vpc-f2880199
2021-08-26 15:58:16 WARNING Deleting launch wizard security group: launch-wizard-2 sg-08fb56da0b1f15361 in VPC: vpc-f2880199
2021-08-26 15:58:16 WARNING Deleting VPC: vpc-f2880199 in region us-east-2
References: