def validate_instance_name(params):
    if params.instance_name:
        if not re.match(INSTANCE_NAME_PATTERN, params.instance_name):
            raise ValueError('Instance name contains invalid characters.')
        if params.instance_name.startswith('i-'):
            raise ValueError('Instance name cannot start with \'i-\'.')
        if len(params.instance_name) > MAX_INSTANCE_NAME_LENGTH:
            raise ValueError(
                'Instance name cannot be longer than {0} characters.'.format(
                    MAX_INSTANCE_NAME_LENGTH
                )
            )
dataset/ETHPy150Open aws/aws-cli/awscli/customizations/codedeploy/utils.py/validate_instance_name/original