Ejemplo n.º 1
0
def ec2_print_instance(full=False):
    """
    Print EC2 instance info.

    :param full: Print all attributes, or just the most useful ones? Defaults
        to ``False``.
    """
    instancewrapper = Ec2InstanceWrapper.get_from_host_string()
    print "Instance:", _get_instanceident(instancewrapper.instance)
    print_ec2_instance(instancewrapper.instance, full=full)
Ejemplo n.º 2
0
def ec2_print_instance(full=False):
    """
    Print EC2 instance info.

    :param full: Print all attributes, or just the most useful ones? Defaults
        to ``False``.
    """
    instancewrapper = Ec2InstanceWrapper.get_from_host_string()
    print 'Instance:', _get_instanceident(instancewrapper.instance)
    print_ec2_instance(instancewrapper.instance, full=full)
Ejemplo n.º 3
0
def ec2_list_instances(region=awsfab_settings.DEFAULT_REGION, full=False):
    """
    List EC2 instances in a region (defaults to awsfab_settings.DEFAULT_REGION).

    :param region: The region to list instances in. Defaults to
        ``awsfab_settings.DEFAULT_REGION.
    :param full: Print all attributes, or just the most useful ones? Defaults
        to ``False``.
    """
    conn = connect_to_region(region_name=region, **awsfab_settings.AUTH)

    for reservation in conn.get_all_instances():
        print
        print "id:", reservation.id
        print "   owner_id:", reservation.owner_id
        print "   groups:"
        for group in reservation.groups:
            print "      - {name} (id:{id})".format(**group.__dict__)
        print "   instances:"
        for instance in reservation.instances:
            attrnames = None
            print "      -", _get_instanceident(instance)
            print_ec2_instance(instance, full=full, indentspaces=11)
Ejemplo n.º 4
0
def ec2_list_instances(region=awsfab_settings.DEFAULT_REGION, full=False):
    """
    List EC2 instances in a region (defaults to awsfab_settings.DEFAULT_REGION).

    :param region: The region to list instances in. Defaults to
        ``awsfab_settings.DEFAULT_REGION.
    :param full: Print all attributes, or just the most useful ones? Defaults
        to ``False``.
    """
    conn = connect_to_region(region_name=region, **awsfab_settings.AUTH)

    for reservation in conn.get_all_instances():
        print
        print 'id:', reservation.id
        print '   owner_id:', reservation.owner_id
        print '   groups:'
        for group in reservation.groups:
            print '      - {name} (id:{id})'.format(**group.__dict__)
        print '   instances:'
        for instance in reservation.instances:
            attrnames = None
            print '      -', _get_instanceident(instance)
            print_ec2_instance(instance, full=full, indentspaces=11)