title: AWS rds for postgres db instance is shutting down and restarted automatically and couldn't connect to DB instance after restart
body: <p>Have created new AWS rds for postgres db instance with default VPC and security group. Was able to connect to db instance via pgadmin4 and pinged through telnet on the same day of DB instance creation. The day after DB instance creation, couldn't connect to DB instance.
      From recent event tab in RDS, could see DB instance is shutting down and restarted automatically after which I couldn't connect to db instance.
      DB instance status is also 'AVAILABLE'.</p>
  
  <p>Note: 1. Two times did the above procedure, same error is repeated after the day of DB instance creation. Used same security and VCP for both the DB and was able to connect on day of DB instance creation.</p>
  
  <ol start="2">
  <li><p>Tried reboot, stop, start, but no luck couldn't connect to DB instance though status is available. I am sure Security and VCP is working fine, since it is working for other DB instance.</p>
  
  <p>Need to known why db instance is shutting down and restarted automatically??
  Though status is available, why couldnt connect to db instance??</p></li>
  </ol>
  
  <p>Below is the Snapshot of AWS Recent Event Tab -</p>
  
  <p>[1] : <a href="https://i.stack.imgur.com/D54bc.jpg" rel="nofollow noreferrer">https://i.stack.imgur.com/D54bc.jpg</a></p>
  
  <pre><code>Log 1 while shut down:
  
  
  2017-12-17 12:02:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:02:52 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.158 s, sync=0.002 s, total=0.172 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=17335 kB
  2017-12-17 12:07:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:07:53 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.165 s, sync=0.002 s, total=0.181 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=17240 kB
  2017-12-17 12:12:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:12:52 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.160 s, sync=0.011 s, total=0.189 s; sync files=1, longest=0.011 s, average=0.011 s; distance=16384 kB, estimate=17154 kB
  2017-12-17 12:17:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:17:52 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.163 s, sync=0.002 s, total=0.181 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16383 kB, estimate=17077 kB
  2017-12-17 12:22:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:22:52 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.160 s, sync=0.002 s, total=0.176 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=17008 kB
  2017-12-17 12:27:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:27:53 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.159 s, sync=0.002 s, total=0.175 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16945 kB
  2017-12-17 12:32:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:32:52 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.158 s, sync=0.002 s, total=0.173 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16383 kB, estimate=16889 kB
  2017-12-17 12:37:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:37:52 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.158 s, sync=0.002 s, total=0.174 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16839 kB
  2017-12-17 12:42:52 UTC::@:[3654]:LOG: checkpoint starting: time
  2017-12-17 12:42:52 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.280 s, sync=0.003 s, total=0.295 s; sync files=1, longest=0.003 s, average=0.003 s; distance=16384 kB, estimate=16793 kB
  2017-12-17 12:47:03 UTC::@:[3651]:LOG: received fast shutdown request
  2017-12-17 12:47:03 UTC::@:[3651]:LOG: aborting any active transactions
  2017-12-17 12:47:03 UTC::@:[3657]:LOG: autovacuum launcher shutting down
  2017-12-17 12:47:03 UTC::@:[3654]:LOG: shutting down
  2017-12-17 12:47:03 UTC::@:[3654]:LOG: checkpoint starting: shutdown immediate
  2017-12-17 12:47:03 UTC::@:[3654]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.001 s, sync=0.002 s, total=0.059 s; sync files=1, longest=0.002 s, average=0.002 s; distance=32765 kB, estimate=32765 kB
  2017-12-17 12:47:03 UTC::@:[3651]:LOG: database system is shut down
  2017-12-17 12:47:05 UTC::@:[949]:LOG: database system was shut down at 2017-12-17 12:47:03 UTC
  2017-12-17 12:47:05 UTC::@:[949]:LOG: MultiXact member wraparound protections are now enabled
  2017-12-17 12:47:05 UTC::@:[947]:LOG: database system is ready to accept connections
  2017-12-17 12:47:05 UTC::@:[953]:LOG: autovacuum launcher started
  2017-12-17 12:52:05 UTC::@:[950]:LOG: checkpoint starting: time
  2017-12-17 12:52:05 UTC::@:[950]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.157 s, sync=0.002 s, total=0.176 s; sync files=1, longest=0.002 s, average=0.002 s; distance=2 kB, estimate=2 kB
  
  Log 2:
  
  2017-12-16 16:34:10 UTC::@:[3651]:WARNING: unrecognized configuration parameter "rds.logical_replication"
  2017-12-16 16:34:10 UTC::@:[3651]:LOG: redirecting log output to logging collector process
  2017-12-16 16:34:10 UTC::@:[3651]:HINT: Future log output will appear in directory "/rdsdbdata/log/error".
  2017-12-17 12:47:05 UTC::@:[947]:WARNING: unrecognized configuration parameter "rds.logical_replication"
  2017-12-17 12:47:05 UTC::@:[947]:LOG: redirecting log output to logging collector process
  2017-12-17 12:47:05 UTC::@:[947]:HINT: Future log output will appear in directory "/rdsdbdata/log/error".
  2017-12-17 13:10:21 UTC::@:[3383]:WARNING: unrecognized configuration parameter "rds.logical_replication"
  2017-12-17 13:10:21 UTC::@:[3383]:LOG: redirecting log output to logging collector process
  2017-12-17 13:10:21 UTC::@:[3383]:HINT: Future log output will appear in directory "/rdsdbdata/log/error".
  </code></pre>
  
  <p>Log 3:</p>
  
  <pre><code>2017-12-17 13:10:21 UTC::@:[3385]:LOG: database system was interrupted; last known up at 2017-12-17 12:52:05 UTC
  2017-12-17 13:10:21 UTC::@:[3385]:LOG: database system was not properly shut down; automatic recovery in progress
  2017-12-17 13:10:21 UTC::@:[3385]:LOG: redo starts at 0/F7000878
  2017-12-17 13:10:21 UTC::@:[3385]:LOG: invalid record length at 0/F80008D8: wanted 24, got 0
  2017-12-17 13:10:21 UTC::@:[3385]:LOG: redo done at 0/F80008A0
  2017-12-17 13:10:21 UTC::@:[3385]:LOG: last completed transaction was at log time 2017-12-17 12:53:15.163928+00
  2017-12-17 13:10:21 UTC::@:[3385]:LOG: checkpoint starting: end-of-recovery immediate
  2017-12-17 13:10:21 UTC::@:[3385]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 0 recycled; write=0.000 s, sync=0.002 s, total=0.015 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16384 kB
  2017-12-17 13:10:21 UTC::@:[3385]:LOG: MultiXact member wraparound protections are now enabled
  2017-12-17 13:10:21 UTC::@:[3383]:LOG: database system is ready to accept connections
  2017-12-17 13:10:21 UTC::@:[3389]:LOG: autovacuum launcher started
  2017-12-17 13:15:21 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:15:21 UTC::@:[3386]:LOG: checkpoint complete: wrote 2 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.261 s, sync=0.002 s, total=0.276 s; sync files=2, longest=0.002 s, average=0.001 s; distance=4 kB, estimate=4 kB
  2017-12-17 13:20:22 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:20:22 UTC::@:[3386]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.156 s, sync=0.002 s, total=0.184 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16379 kB, estimate=16379 kB
  2017-12-17 13:25:22 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:25:22 UTC::@:[3386]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.155 s, sync=0.002 s, total=0.169 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16384 kB
  2017-12-17 13:30:22 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:30:23 UTC::@:[3386]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.158 s, sync=0.002 s, total=0.171 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16384 kB
  2017-12-17 13:35:22 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:35:22 UTC::@:[3386]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.161 s, sync=0.003 s, total=0.176 s; sync files=1, longest=0.003 s, average=0.003 s; distance=16384 kB, estimate=16384 kB
  2017-12-17 13:40:22 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:40:22 UTC::@:[3386]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.157 s, sync=0.002 s, total=0.170 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16384 kB
  2017-12-17 13:45:22 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:45:22 UTC::@:[3386]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.160 s, sync=0.002 s, total=0.178 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16384 kB
  2017-12-17 13:50:22 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:50:22 UTC::@:[3386]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.156 s, sync=0.002 s, total=0.169 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16384 kB
  2017-12-17 13:55:23 UTC::@:[3386]:LOG: checkpoint starting: time
  2017-12-17 13:55:23 UTC::@:[3386]:LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 transaction log file(s) added, 0 removed, 1 recycled; write=0.155 s, sync=0.002 s, total=0.169 s; sync files=1, longest=0.002 s, average=0.002 s; distance=16384 kB, estimate=16384 kB
  ----------------------- END OF LOG ----------------------
  </code></pre>