title: Connecting to AWS Redshift with Python
body: <p>I'm attempting to build a simple connection to a Redshift cluster via Python and the redshift_connector library.  I'm pretty new to AWS and Python so I'm just trying to get a basic connection set up by following the AWS documentation.  The example I'm following uses hard-coded credentials (which I know is not best practice, but I'm just trying to get anything to work as a start).  Here's the code I'm using:</p>
  <pre><code>import redshift_connector
  
  from secrets import rs_host, rs_user, rs_pw # File that contains credentials
  
  ##### Opening Redshift Connection #####
  
  with redshift_connector.connect(
      host = rs_host,
      database = 'dev',
      user = rs_user,
      password = rs_pw,
  ) as conn:
      with conn.cursor() as cursor:
          cursor.execute(&quot;SELECT TOP 10* FROM public.sales&quot;)
  
          result: tuple = cursor.fetchall()
          print(result)
  </code></pre>
  <p>And here's the error message I'm getting :</p>
  <pre><code>redshift_connector.error.InterfaceError: ('communication error', gaierror(11001, 'getaddrinfo failed'))
  </code></pre>
  <p>I'm unsure if I'm using the correct credentials for username/password.  I can't find any specifications in the documentation, so I'm using my aws root email and password, which are in another file that I'm importing into this file.  Are these the correct credentials?</p>
  <p>Here's the documentation for reference:
  <a href="https://github.com/aws/amazon-redshift-python-driver/blob/master/tutorials/001%20-%20Connecting%20to%20Amazon%20Redshift.ipynb" rel="nofollow noreferrer">https://github.com/aws/amazon-redshift-python-driver/blob/master/tutorials/001%20-%20Connecting%20to%20Amazon%20Redshift.ipynb</a></p>