Example #1
0
def get_instance_ip_by_name(name=None):
  conn = connect_ec2.get_connection()
  try:
    instance = _get_instance_by_name(conn, name)
    print instance.public_dns_name
  except:
    print 'Failed to find instance'
Example #2
0
def stop_instance_by_name(name=None):
  conn = connect_ec2.get_connection()
  try:
    instance = _get_instance_by_name(conn, name)
    conn.stop_instances([instance.id])
    print 'Done'
  except:
    print 'Failed to stop instance'