title: Python Connect AWS ElasticSearch Domain and upload, retrieve data
body: <p>I have setup the elasticsearch domain in AWS Elasticsearch Service.
  It has endpoint like "<a href="https://search-testelasticseach-xxxxxxxxxxxxxxxxxxx.us-east-2.es.amazonaws.com" rel="nofollow noreferrer">https://search-testelasticseach-xxxxxxxxxxxxxxxxxxx.us-east-2.es.amazonaws.com</a>". I am trying to connect the AWS Elasticsearch Domain endpoint using IAM users after adding policies in that elasticsearch domain.</p>
  
  <p>Error says </p>
  
  <p><code>"Max retries exceeded with url: //search-testelasticseach-XXXXXXXXXXXXXXX.us-east-2.es.amazonaws.com:443/ (Caused by NewConnectionError('&lt;urllib3.connection.VerifiedHTTPSConnection object at 0x105111d68&gt;: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))) caused by: ConnectionError(HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //search-testelasticseach-pkpbravqd4djbi3kjtihsra5ma.us-east-2.es.amazonaws.com:443/ (Caused by NewConnectionError('&lt;urllib3.connection.VerifiedHTTPSConnection object at 0x105111d68&gt;: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known')))"</code></p>
  
  <p>Code Snippet:</p>
  
  <pre><code>from elasticsearch import Elasticsearch, RequestsHttpConnection
  from requests_aws4auth import AWS4Auth
  YOUR_ACCESS_KEY = "XXX"
  YOUR_SECRET_KEY = "XXXX"
  REGION = "us-east-2"
  host = 'https://search-testelasticseach-XXX.us-east-2.es.amazonaws.com'
  awsauth = AWS4Auth(YOUR_ACCESS_KEY, YOUR_SECRET_KEY, REGION, 'es')
  
  es = Elasticsearch(
      hosts=[{'host': host, 'port': 443}],
      http_auth=awsauth,
      use_ssl=True,
      verify_certs=True,
      connection_class=RequestsHttpConnection
  )
  
  
  print(es.info())
  </code></pre>