def get_ami_metadata():
  """Fetch ami metadata for the local instance. Returns a dict of 'key':'value'. eg: 'instance-id':'i-e7f7e69b'."""
  res = {}
  base_url = 'http://169.254.169.254/latest/meta-data'
  instance_id = run('curl %s/instance-id' % base_url)
  assert re.match('i-[0-9a-f]{8}', instance_id)
  res['instance-id'] = instance_id

  return res
dataset/ETHPy150Open viewfinderco/viewfinder/fabfile.py/get_ami_metadata/original