Refactoring.

Simplify the creation of security groups, simplify the instance preparing
and move the creation of security groups in setUpClass.