Refactoring a check of EC2-Classic