title: ConnectionRefusedError: [Errno 61] Connection refused & Could not connect to the endpoint URL: http://127.0.0.1:3001
body: <p>I am trying to run integration tests using boto3 and aws. It seems the tests are unable to connect to the localhost endpoint so the tests are failing. I'm quite sure I've configured my aws environment variables correctly. I suspect that maybe there is no local server running but I'm still unsure how to fix the problem. Any help would be greatly appreciated. </p>
  
  <p>I'm running on Mac Mojave, I've tried changing the ports that the server is attempting to connect to localhost:3000. I've also tried connecting to a server that I'm running using AWS Step Functions (<a href="https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local-config-options.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local-config-options.html</a>) but with no luck. </p>
  
  <p>Error messages from Log:</p>
  
  <pre><code>ConnectionRefusedError: [Errno 61] Connection refused
  </code></pre>
  
  <p>and </p>
  
  <pre><code>raise EndpointConnectionError(endpoint_url=request.url, error=e)
  botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:3001/2015-03-31/functions/AthenaDatabaseProvider/invocations"
  </code></pre>
  
  <p>Complete Log: </p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
      (self._dns_host, self.port), self.timeout, **extra_kw)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
      raise err
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
      sock.connect(sa)
  ConnectionRefusedError: [Errno 61] Connection refused
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/httpsession.py", line 262, in send
      chunked=self._chunked(request.headers),
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
      _stacktrace=sys.exc_info()[2])
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/util/retry.py", line 344, in increment
      raise six.reraise(type(error), error, _stacktrace)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/packages/six.py", line 686, in reraise
      raise value
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
      chunked=chunked)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
      conn.request(method, url, **httplib_request_kw)
    File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1244, in request
      self._send_request(method, url, body, headers, encode_chunked)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/awsrequest.py", line 125, in _send_request
      method, url, body, headers, *args, **kwargs)
    File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1290, in _send_request
      self.endheaders(body, encode_chunked=encode_chunked)
    File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1239, in endheaders
      self._send_output(message_body, encode_chunked=encode_chunked)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/awsrequest.py", line 152, in _send_output
      self.send(msg)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/awsrequest.py", line 236, in send
      return super(AWSConnection, self).send(str)
    File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 966, in send
      self.connect()
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
      conn = self._new_conn()
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
      self, "Failed to establish a new connection: %s" % e)
  urllib3.exceptions.NewConnectionError: &lt;botocore.awsrequest.AWSHTTPConnection object at 0x11ea50d90&gt;: Failed to establish a new connection: [Errno 61] Connection refused
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/Users/patrickward/repositories/JAM/hobbes/transformations/tests/integration/lambdas/athena_database_provider_test.py", line 97, in test_drop_with_stack_false_keeps_database_on_delete
      invoke_fn(cloud_formation_event('Delete', DatabaseName=existent_database, DropWithStack='False'))
    File "/Users/patrickward/repositories/JAM/hobbes/transformations/tests/integration/lambdas/athena_database_provider_test.py", line 54, in _exec
      Payload=json.dumps(event)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
      return self._make_api_call(operation_name, kwargs)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/client.py", line 648, in _make_api_call
      operation_model, request_dict, request_context)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/client.py", line 667, in _make_request
      return self._endpoint.make_request(operation_model, request_dict)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/endpoint.py", line 102, in make_request
      return self._send_request(request_dict, operation_model)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/endpoint.py", line 137, in _send_request
      success_response, exception):
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/endpoint.py", line 231, in _needs_retry
      caught_exception=caught_exception, request_dict=request_dict)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/hooks.py", line 356, in emit
      return self._emitter.emit(aliased_event_name, **kwargs)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/hooks.py", line 228, in emit
      return self._emit(event_name, kwargs)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/hooks.py", line 211, in _emit
      response = handler(**kwargs)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/retryhandler.py", line 183, in __call__
      if self._checker(attempts, response, caught_exception):
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/retryhandler.py", line 251, in __call__
      caught_exception)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/retryhandler.py", line 277, in _should_retry
      return self._checker(attempt_number, response, caught_exception)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/retryhandler.py", line 317, in __call__
      caught_exception)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/retryhandler.py", line 223, in __call__
      attempt_number, caught_exception)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
      raise caught_exception
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/endpoint.py", line 200, in _do_get_response
      http_response = self._send(request)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/endpoint.py", line 244, in _send
      return self.http_session.send(request)
    File "/Users/patrickward/.local/share/virtualenvs/hobbes-iOpBOaJm/lib/python3.7/site-packages/botocore/httpsession.py", line 282, in send
      raise EndpointConnectionError(endpoint_url=request.url, error=e)
  botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:3001/2015-03-31/functions/AthenaDatabaseProvider/invocations"
  </code></pre>