I think this only fixes a sub-issue with the ticket. On some tests I ran, you sill get SecurityGroups and KeyPairs left behind (but much less).
However, I think the remaining instances are really related to the issue [JCLOUDS-529](https://issues.apache.org/jira/browse/JCLOUDS-529) which has been closed, but still causes things to be left behind. The fix that closes it just changes the exception type, I don't think it solves the underlying issue. The test code I added to that ticket showed it can sometimes take 60s or more for a SecurityGroup to be released (i.e. no longer be dependent on the instance being deleted and therefore not deletable). I currently catch that exception and retry deleting the security group for longer which solves the problem for me. Maybe pulling that timing out into a variable would be a sensible solution. So the time trying to delete it can be set to be longer if you care more about it, but don't have to wait so long if you don't mind the artefacts being left behind. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/741#issuecomment-99857914
