slight refactoring to the EC2 inventory script