macosamazon-ec2terminalosx-snow-leopard

Formatting list of Amazon EC2 instances from the command line


I retrieve data about my current Amazon EC2 instances with ec2-describe-instances -H, which returns something like the following:

Type    ReservationID   Owner   Groups  Platform
RESERVATION r-xxxxxxxx  xxxxxxxxxxxx    default
INSTANCE    i-xxxxxxxx  ami-2b5fba42    ec2-xx-xx-xx-xx.compute-1.amazonaws.com ip-xx-xx-xx-xx.ec2.internal running user    0       m1.small    2011-07-12T21:15:39+0000    us-east-1a  aki-xxxxxxxx    ari-xxxxxxxx        monitoring-disabled xx.xx.xx.xx xx.xx.xx.xx         instance-store          paravirtual xen     sg-xxxxxxxx default

This looks messy in the OS X terminal. How can I make this output more readable?


Solution

  • I just whipped up a little bash/awk script you might be interested in:

    https://github.com/epheph/fec2din

    It displays EC2 instance output in the format of:

    Instance: i-57192e11
    AMI: ami-a7f539ce
    Type: t1.micro
    Public IP: 50.99.41.60 (ec2-50-99-41-60.compute-1.amazonaws.com)
    Private IP: 10.99.241.197
    Public Key: production
    Start Time: 2011-11-09
    Security Group: production
    Block Devices:
        /dev/sda1
        /dev/sdj
        /dev/sdk