'Create a new instance based on the specified configuration file or the specified
configuration and the passed in parameters.
If the config_file argument is not None, the configuration is read from there.
Otherwise, the cfg argument is used.
The config file may include other config files with a #import reference. The included
config files must reside in the same directory as the specified file.
The logical_volume argument, if supplied, will be used to get the current physical
volume ID and use that as an override of the value specified in the config file. This
may be useful for debugging purposes when you want to debug with a production config
file but a test Volume.
The dictionary argument may be used to override any EC2 configuration values in the
config file.'

@classmethod
def create(cls, config_file=None, logical_volume=None, cfg=None, **params):

    if config_file:
        cfg = Config(path=config_file)
    if cfg.has_section('EC2'):
        for option in cfg.options('EC2'):
            if (option not in params):
                params[option] = cfg.get('EC2', option)
    getter = CommandLineGetter()
    getter.get(cls, params)
    region = params.get('region')
    ec2 = region.connect()
    cls.add_credentials(cfg, ec2.aws_access_key_id, ec2.aws_secret_access_key)
    ami = params.get('ami')
    kp = params.get('keypair')
    group = params.get('group')
    zone = params.get('zone')
    if (logical_volume != None):
        cfg.set('EBS', 'logical_volume_name', logical_volume.name)
    cfg_fp = StringIO()
    cfg.write(cfg_fp)
    if isinstance(zone, Zone):
        zone = zone.name
    if isinstance(kp, KeyPair):
        kp = kp.name
    reservation = ami.run(min_count=1, max_count=params.get('quantity', 1), key_name=kp, security_groups=[group], instance_type=params.get('instance_type'), placement=zone, user_data=cfg_fp.getvalue())
    l = []
    i = 0
    elastic_ip = params.get('elastic_ip')
    instances = reservation.instances
    if ((elastic_ip is not None) and (instances.__len__() > 0)):
        instance = instances[0]
        print 'Waiting    for    instance    to    start    so    we    can    set    its    elastic    IP    address...'
        time.sleep(5)
        while (instance.update() != 'running'):
            time.sleep(1)
        instance.use_ip(elastic_ip)
        print ('set    the    elastic    IP    of    the    first    instance    to    %s' % elastic_ip)
    for instance in instances:
        s = cls()
        s.ec2 = ec2
        s.name = ((params.get('name') + '') if (i == 0) else str(i))
        s.description = params.get('description')
        s.region_name = region.name
        s.instance_id = instance.id
        if (elastic_ip and (i == 0)):
            s.elastic_ip = elastic_ip
        s.put()
        l.append(s)
        i += 1
    return l
