Destroy VPC (and everything related with it)

75 views
Skip to first unread message

Andres Riancho

unread,
May 9, 2013, 12:38:55 PM5/9/13
to boto-...@googlegroups.com
List,

    I've been playing with VPCs lately, creating new ones, creating subnets and EC2 instances in them, etc. At some point I want to destroy the VPC and everything inside it in an automated way. Someone out there had to do this and can share some code? If there is none, I'll create it... but it seems a common use case: given a vpc id, list all subnets, list all ec2 instances, check if they live in the vpc subnets, kill them. Then do something similar with all the other things which can be related to a VPC (security groups, elastic ips, autoscaling groups, etc. etc.)

Regards,
-- 
Andrés Riancho
Project Leader at w3af - http://w3af.org/
Web Application Attack and Audit Framework
Twitter: @w3af
GPG: 0x93C344F3

James Martin

unread,
May 10, 2013, 6:25:42 PM5/10/13
to boto-...@googlegroups.com
You can do this using the cloudformation module -- you'd just delete
the cloudformation stack and it would automatically delete all of the
dependencies. Of course you'd have to convert your entire play into
cloudformation json stuff. I'm not sure how/if you can do this with
the ec2 module.

- James
> --
> You received this message because you are subscribed to the Google Groups
> "boto-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to boto-users+...@googlegroups.com.
> To post to this group, send email to boto-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/boto-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages