title: SOLVED: Laravel: connection to AWS RDS results in a timed out
body: <p>I was trying to migrate the database to AWS RDS through Laravel using <code>php artisan migrate</code>, however, it gave me this error:  </p>
  
  <pre><code>Illuminate\Database\QueryException  : SQLSTATE[08006] [7] could not connect to server: Connection timed out (0x0000274C/10060)
  Is the server running on host "xxxxxxxxx.xxxxxxxxx.us-east-2.rds.amazonaws.com" (xx.xxx.xxx.xxx) and accepting
  TCP/IP connections on port 5432? (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations)
  </code></pre>
  
  <p>I have done some researches on this issue, what I found is I need to create a new security group to allow the access from my IP address, and I have added a new rule with the Type of "PostgreSQL" and its default settings but my IP in the "Source" column.  And I am still not able to migrate my database (giving me the same error as above)</p>
  
  <p>This is the database config in the .env file, maybe some fields are wrong?</p>
  
  <pre><code>DB_CONNECTION=pgsql
  DB_HOST=xxxxxxxxx.xxxxxxxxx.us-east-2.rds.amazonaws.com
  DB_PORT=5432
  DB_DATABASE=xxxx
  DB_USERNAME=xxxx
  DB_PASSWORD=xxxx
  </code></pre>
  
  <p>I would be appreciated for any helps!</p>