title: Connect to Redshift from AWS Lambda
body: <p>I'm trying to connect to my <code>Redshift</code> database from my <code>AWS Lambda</code> function:</p>
  
  <pre><code>con = psycopg2.connect(
      dbname="my_dbname",
      host="my_url",
      port= 5439,
      user="username",
      password="my_password")
  
  cur = con.cursor()
  </code></pre>
  
  <p>But I can't access my database, my function raises the following error:</p>
  
  <pre><code>OperationalError: could not connect to server: Connection timed out
      Is the server running on host "my_url" (54.217.83.88) and accepting
      TCP/IP connections on port 5439?
  </code></pre>
  
  <p>Can i get some help with this please ? (and if possible I'd like to have a very detailed answer, because I'm new to AWS )</p>
  
  <p>PS: I know that I have to configure the VPC, but I don't know what to do exactly</p>
  
  <p>Thanks you in advance</p>