Created
November 24, 2022 10:50
-
-
Save chandradeoarya/842fdf4200146e66afcfe8908bfe0cc2 to your computer and use it in GitHub Desktop.
Bash script to delete all components of VPC completely
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vpc="vpc-01c4ba22f251d0831" | |
aws ec2 describe-internet-gateways --filters 'Name=attachment.vpc-id,Values='$vpc | grep InternetGatewayId | |
aws ec2 describe-subnets --filters 'Name=vpc-id,Values='$vpc | grep SubnetId | |
aws ec2 describe-route-tables --filters 'Name=vpc-id,Values='$vpc | grep RouteTableId | |
aws ec2 describe-network-acls --filters 'Name=vpc-id,Values='$vpc | grep NetworkAclId | |
aws ec2 describe-vpc-peering-connections --filters 'Name=requester-vpc-info.vpc-id,Values='$vpc | grep VpcPeeringConnectionId | |
aws ec2 describe-vpc-endpoints --filters 'Name=vpc-id,Values='$vpc | grep VpcEndpointId | |
aws ec2 describe-nat-gateways --filter 'Name=vpc-id,Values='$vpc | grep NatGatewayId | |
aws ec2 describe-security-groups --filters 'Name=vpc-id,Values='$vpc | grep GroupId | |
aws ec2 describe-instances --filters 'Name=vpc-id,Values='$vpc | grep InstanceId | |
aws ec2 describe-vpn-connections --filters 'Name=vpc-id,Values='$vpc | grep VpnConnectionId | |
aws ec2 describe-vpn-gateways --filters 'Name=attachment.vpc-id,Values='$vpc | grep VpnGatewayId | |
aws ec2 describe-network-interfaces --filters 'Name=vpc-id,Values='$vpc | grep NetworkInterfaceId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment