<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: alade lekan </title>
    <description>The latest articles on DEV Community by alade lekan  (@alicxc).</description>
    <link>https://dev.to/alicxc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F119209%2F65a96220-a260-4731-9c06-8f9aedb3e205.png</url>
      <title>DEV Community: alade lekan </title>
      <link>https://dev.to/alicxc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alicxc"/>
    <language>en</language>
    <item>
      <title>Top 3 Effective Methods To Fix Database connection issues on AWS RDS(Postgres)</title>
      <dc:creator>alade lekan </dc:creator>
      <pubDate>Fri, 09 Jun 2023 21:39:23 +0000</pubDate>
      <link>https://dev.to/alicxc/how-to-fix-connection-errors-while-connecting-to-rds-postgres-database-remotely-on-aws-using-3-effective-methods-2epn</link>
      <guid>https://dev.to/alicxc/how-to-fix-connection-errors-while-connecting-to-rds-postgres-database-remotely-on-aws-using-3-effective-methods-2epn</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ejjjRX3L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6706/0%2AFEwB0q9ihD9wkytF" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ejjjRX3L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6706/0%2AFEwB0q9ihD9wkytF" alt="Photo by [Kevin Ku](https://unsplash.com/pt-br/@ikukevk?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Solving connection errors while connecting to AWS RDS remotely has been one of the trickiest things during development and deployment due to issues like misconfiguration, incorrect credentials, etc. However, in this tutorial, we will learn how to fix these issues using 3 different approaches.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Prerequisites&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Familiar with AWS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Knowledge of Database (Postgres)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Method 1:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Make sure your database is &lt;strong&gt;publicly accessible&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_A8oSLcP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/5304/1%2Ad6nRKunxGNEDzxow686d7Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_A8oSLcP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/5304/1%2Ad6nRKunxGNEDzxow686d7Q.png" alt="" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To confirm if your database is accessible, follow the steps below:&lt;/p&gt;

&lt;p&gt;Go to your &lt;strong&gt;RDS&lt;/strong&gt;, and select your &lt;strong&gt;database instance&lt;/strong&gt; to check if it is publicly accessible, if it is not accessible, click on &lt;strong&gt;modify&lt;/strong&gt;, under &lt;strong&gt;Connectivity&lt;/strong&gt;, click on &lt;strong&gt;additional configuration&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;and&lt;/em&gt;&lt;/strong&gt; select Publicly accessible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Skw3BAnz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/3212/1%2AKhS1vpIs0g1aI2U42hRc6Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Skw3BAnz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/3212/1%2AKhS1vpIs0g1aI2U42hRc6Q.png" alt="" width="800" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With these, you can easily access your database instance remotely.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Method 2:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Add Your &lt;strong&gt;IP address&lt;/strong&gt; to the &lt;strong&gt;VPC security group&lt;/strong&gt;(firewall).&lt;/p&gt;

&lt;p&gt;Make sure your local &lt;strong&gt;IP&lt;/strong&gt; is added to the &lt;strong&gt;VPC security group&lt;/strong&gt; firewall to allow incoming connections from your IP using these steps&lt;/p&gt;

&lt;p&gt;Go to your &lt;strong&gt;RDS&lt;/strong&gt;, select your &lt;strong&gt;database instance&lt;/strong&gt;, under your &lt;strong&gt;connectivity and security&lt;/strong&gt;, and click your default &lt;strong&gt;security group&lt;/strong&gt; under &lt;strong&gt;VPC security groups.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2oT-hks7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/5500/1%2AkoAjbymBSooDsf6bCN-TDg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2oT-hks7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/5500/1%2AkoAjbymBSooDsf6bCN-TDg.png" alt="" width="800" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;security groups&lt;/strong&gt; page, make sure the default security group is selected, and scroll down to check if the inbound rules have the following rules above, if not, then you need to add an inbound rule. To add inbound rules, click on &lt;strong&gt;Edit inbound rules&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F9tLLgcQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6496/1%2AR-QtLo5YGZelgsDUG1bmTQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F9tLLgcQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6496/1%2AR-QtLo5YGZelgsDUG1bmTQ.png" alt="" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;strong&gt;Add rule&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jOFjuqOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6096/1%2A4JO6acsFYu_zWgGkeUJcdA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jOFjuqOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6096/1%2A4JO6acsFYu_zWgGkeUJcdA.png" alt="" width="800" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select your preferred &lt;strong&gt;type&lt;/strong&gt;, in this article, &lt;strong&gt;Postgres&lt;/strong&gt; is the preferred &lt;strong&gt;DB&lt;/strong&gt;, to add your &lt;strong&gt;IP:&lt;/strong&gt; select &lt;strong&gt;custom&lt;/strong&gt; and type your &lt;strong&gt;IP&lt;/strong&gt; inside the box next to the &lt;strong&gt;source.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By following the step above, you have access to the database remotely.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Method 3:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Check if &lt;strong&gt;Subnets&lt;/strong&gt; in your &lt;strong&gt;default VPC&lt;/strong&gt; have access to the &lt;strong&gt;internet gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Make sure your RDS default &lt;strong&gt;VPC&lt;/strong&gt; and &lt;strong&gt;subnets&lt;/strong&gt; have access to the internet gateway. Check if the &lt;strong&gt;Route table&lt;/strong&gt; for each subnet has a route ID attached to it, kindly follow the steps below.&lt;/p&gt;

&lt;p&gt;Go to your &lt;strong&gt;RDS&lt;/strong&gt;, select your &lt;strong&gt;database instance&lt;/strong&gt;, under your &lt;strong&gt;connectivity and security&lt;/strong&gt;, and click each &lt;strong&gt;subnet&lt;/strong&gt; under &lt;strong&gt;Subnets&lt;/strong&gt; to confirm if a &lt;strong&gt;Route table&lt;/strong&gt; is attached to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T7HgwTBY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6164/1%2A2aOWsees90KFQ-ALOkbefA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T7HgwTBY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6164/1%2A2aOWsees90KFQ-ALOkbefA.png" alt="" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the subnet page, Select the desired subnet, and check the Route table to see if a value is attached to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1YO6nmk4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/7496/1%2AhXLMDZfpxHwC8Dg5SLO_kQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1YO6nmk4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/7496/1%2AhXLMDZfpxHwC8Dg5SLO_kQ.png" alt="" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If false, then click on &lt;strong&gt;Route tables&lt;/strong&gt; to copy a route table id attached to your VPC. Then navigate back to your subnet page, under the subnet details, click the Route Table tab, to attach the route table ID you copied.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yDI_4RnZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/7652/1%2Aha2Qa-OXZGJmYSgqxygtuw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yDI_4RnZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/7652/1%2Aha2Qa-OXZGJmYSgqxygtuw.png" alt="" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the &lt;strong&gt;Edit route table association&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0yyd6Okd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/3492/1%2AYYWkbAbKhRN-eqSQ5uP1nQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0yyd6Okd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/3492/1%2AYYWkbAbKhRN-eqSQ5uP1nQ.png" alt="" width="800" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paste the copied route table id into the Route table ID select box, then choose it and save it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;Solving database connection issues is tricky but straightforward. Most of the time, it is either due to internet connectivity or misconfiguration that causes major issues when interacting with the database on AWS. I hope this helps you solve your issue. Kindly check &lt;a href="https://aws.amazon.com/rds/"&gt;AWS documentation&lt;/a&gt; if the above solutions do not help solve your connection issues&lt;/p&gt;

</description>
      <category>aws</category>
      <category>database</category>
      <category>postgres</category>
      <category>networking</category>
    </item>
  </channel>
</rss>
