diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index 2ca4d8020d6bf6aea822628080a23252204ab299..17276db6e55d8d05c26107e7d960faf6a6406d96 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -509,6 +509,20 @@ def main():
         print "Terminating zoo..."
         for inst in zoo_nodes:
           inst.terminate()
+      # Delete security groups as well
+      group_names = [cluster_name + "-master", cluster_name + "-slaves", cluster_name + "-zoo"]
+      groups = conn.get_all_security_groups()
+      for group in groups:
+        if group.name in group_names:
+          print "Deleting security group " + group.name
+          # Delete individual rules before deleting group to remove dependencies
+          for rule in group.rules:
+            for grant in rule.grants:
+                group.revoke(ip_protocol=rule.ip_protocol,
+                         from_port=rule.from_port,
+                         to_port=rule.to_port,
+                         src_group=grant)
+          conn.delete_security_group(group.name)
 
   elif action == "login":
     (master_nodes, slave_nodes, zoo_nodes) = get_existing_cluster(