def is_aws_instance():
 global __IS_ON_AWS
 if (__IS_ON_AWS == None):
  __IS_ON_AWS = fetch(AWS_METADATA_URL, timeout=1).ok()
 return __IS_ON_AWS

def is_aws_instance ( ) : global __IS_ON_AWS if ( __IS_ON_AWS == None ) : __IS_ON_AWS = fetch ( AWS_METADATA_URL , timeout = 1 ) . ok ( ) return __IS_ON_AWS
determine if we are running on an amazon web services instance .