def status(opts, conf): ec2 = aws.get_ec2_conn(conf) instances = aws.filter_instances(opts, conf) if instances: print "Active Instances" now = time.time() for i in instances: uptime = aws.get_uptime(now, i.launch_time) print ' ', i.image_id, aws.format_uptime(uptime), i.public_dns_name requests = ec2.get_all_spot_instance_requests() if requests: print "Spot Requests" for r in requests: dns_name = '' print " %s %s %s %s $%s %s %s" % (r.id, r.region, r.type, r.create_time, r.price, r.state, r.status)
def status(opts, conf): now = time.time() instances = aws.filter_instances(opts, conf, {'instance-state-name': 'running'}) if instances: print "Running Instances" for i in instances: uptime = aws.get_uptime(now, i.launch_time) print ' ', i.image_id, aws.format_uptime( uptime), i.public_dns_name, i.tags requests = aws.get_all_spot_instance_requests( opts, conf, {'state': ['active', 'open']}) if requests: print "Active Spot Requests" for r in requests: print " %s %s %s %s $%s %s %s %s" % (r.id, r.region, r.type, r.create_time, r.price, r.state, r.status, r.tags)
def instances(opts, conf): now = time.time() for i in aws.filter_instances(opts, conf): uptime = aws.get_uptime(now, i.launch_time) print i.state, i.image_id, aws.format_uptime( uptime), i.public_dns_name, i.tags
def instances(opts, conf): now = time.time() for i in aws.filter_instances(opts, conf): uptime = aws.get_uptime(now, i.launch_time) print i.image_id, aws.format_uptime(uptime), i.public_dns_name