Magento Connection timed out
<p>I am having an issue with a Magento migration, I was developing a theme and uploading some products, everything works normal.</p>

<p>The problem is when I try to move the ecosystem from dev to prod, I cloned an Amazon EC2 Instance and an Amazon RDS db, then in the prod instance I point the database to the prod instance and it stops working. I change the db details on <code>app/etc/local.xml</code>, I removed cache and session, and it keeps showing </p>

<pre><code>    a:4:{i:0;s:43:"SQLSTATE[HY000] [2002] Connection timed out";i:1;s:2493:"#0 /opt/bitnami/apache2/htdocs/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract-&gt;_connect()
    #1 /opt/bitnami/apache2/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(396): Zend_Db_Adapter_Pdo_Mysql-&gt;_connect()
    #2 /opt/bitnami/apache2/htdocs/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql-&gt;_connect()
    #3 /opt/bitnami/apache2/htdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&gt;query('SET NAMES utf8', Array)
    #4 /opt/bitnami/apache2/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract-&gt;query('SET NAMES utf8', Array)
    #5 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource.php(179): Varien_Db_Adapter_Pdo_Mysql-&gt;query('SET NAMES utf8')
    #6 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource-&gt;_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
    #7 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource-&gt;getConnection('core_write')
    #8 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract-&gt;_getConnection('write')
    #9 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract-&gt;_getWriteAdapter()
    #10 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Resource/Cache.php(53): Mage_Core_Model_Resource_Db_Abstract-&gt;_getReadAdapter()
    #11 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Cache.php(478): Mage_Core_Model_Resource_Cache-&gt;getAllOptions()
    #12 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Cache.php(520): Mage_Core_Model_Cache-&gt;_initOptions()
    #13 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/App.php(1202): Mage_Core_Model_Cache-&gt;canUse('config')
    #14 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Config.php(414): Mage_Core_Model_App-&gt;useCache('config')
    #15 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/Config.php(294): Mage_Core_Model_Config-&gt;_canUseCacheForInit()
    #16 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/App.php(424): Mage_Core_Model_Config-&gt;loadModulesCache()
    #17 /opt/bitnami/apache2/htdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App-&gt;_initModules()
    #18 /opt/bitnami/apache2/htdocs/app/Mage.php(684): Mage_Core_Model_App-&gt;run(Array)
    #19 /opt/bitnami/apache2/htdocs/index.php(83): Mage::run('', 'store')
    #20 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";}
</code></pre>

<p>Everything works normal with the prod instance pointing to dev db instance</p>

<p>PROD Bitnami is a copy of DEV Bitnami
PROD RDS DB  is a restored snapshot of DEV RDS DB</p>