refactor, detects domain/host and uses the config registered to that domain/host (defaults to ec2 if domain not found)
added debug verbosity
added api error handling
added api error handling
added api error handling