def get_ami_metadata():
 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

def get_ami_metadata ( ) : 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
fetch ami metadata for the local instance .