'Implements GenericVmValidateBomDeployer interface.'

def do_create_vm(self, options):

    pem_basename = os.path.basename(options.deploy_aws_pem_path)
    key_pair_name = os.path.splitext(pem_basename)[0]
    logging.info('Creating    "%s"    with    key-pair    "%s"', options.deploy_aws_name, key_pair_name)
    response = check_run_and_monitor('aws    ec2    run-instances    --profile    {region}    --output    json    --count    1    --image-id    {ami}    --instance-type    {type}    --key-name    {key_pair_name}    --security-group-ids    {sg}'.format(region=options.deploy_aws_region, ami=options.deploy_aws_ami, type='t2.xlarge', key_pair_name=key_pair_name, sg=options.deploy_aws_security_group), echo=False)
    doc = json.JSONDecoder().decode(response.stdout)
    self.__instance_id = doc['Instances'][0]['InstanceId']
    logging.info('Created    instance    id=%s    to    tag    as    "%s"', self.__instance_id, options.deploy_aws_name)
    time.sleep(5)
    end_time = (time.time() + (10 * 60))
    did_tag = False
    while (time.time() < end_time):
        if (not did_tag):
            tag_response = run_quick('aws    ec2    create-tags    --region    {region}    --resources    {instance_id}    --tags    "Key=Name,Value={name}"'.format(region=options.deploy_aws_region, instance_id=self.__instance_id, name=options.deploy_aws_name), echo=False)
            did_tag = (tag_response.returncode == 0)
        if self.__is_ready():
            return
        time.sleep(5)
    raise RuntimeError('Giving    up    waiting    for    deployment.')
