title: Connecting to Amazon AWS PostgreSQL database from R session
body: <p>I have a database instance running on Amazon AWS. I use the <code>RPostgreSQL</code> package to connect my R session to my AWS database.</p>
  
  <p>My issue is that every time I attempt to connect to my database instance after not having done so for a while, I get a "Connection timed out" error.</p>
  
  <p>I can then use a browser to go to my AWS Console, edit the Inbound and Outbound rules for my security group to allow my IP Inbound &amp; Outbound access. Then I can connect again just fine.</p>
  
  <p>But then if I don't work on my database for a day or two, when I try to connect to my DB, it doesn't work, and the permissions for Inbound/Outbound access no longer match my IP address (which I'm sure is the cause of the problem).</p>
  
  <p>So... is my IP address changing? Or are the edits I'm making to my security group's inbound/outbound permissions not being saved correctly?</p>
  
  <p>To be clear, here's the order of events of how things have been going:</p>
  
  <ul>
  <li>Haven't worked on DB for a few days, attempt to connect from my R sessions. I get an error.</li>
  <li>Use browser to go to AWS Console and edit my security group's Inbound/Outbound rules by selecting "My IP"</li>
  <li>Try again to connect to my DB from my R session. Hooray! It works.</li>
  <li>A few days later - pick up the project again, attempt to reconnect to my AWS DB from R, and it no longer works...</li>
  <li>Repeat this cycle of madness</li>
  <li>Make post on SO hoping for an angel to help me</li>
  </ul>
  
  <p>This isn't a debilitating problem, it's just extremely annoying to have to re-do my security settings every time I want to connect to my AWS DB.</p>
  
  <p>Thanks in advance for any help you can provide!</p>