refactor getExistEc2Instance method.