title: How to use new secret created by key rotation from AWS Secrets Manager
body: <p>I have a Java application using MongoDB (or it could be any service like that). On start up, the app creates a singleton connection to database. To connect, I get the MongoDB from AWS Secrets Manager... and thus the application runs merrily ever after communicating with MongoDB.</p>
  
  <p>My question is: What happens when AWS Secrets Manager rotates keys?</p>
  
  <ul>
  <li>How does my app come to 'know' that secret has been rotated.</li>
  <li>Do I have to synchronize the timing between Secrets Manager and my app? </li>
  </ul>
  
  <p>e.g. rotation is set to 7 days. So I code in my app to refresh every 7 days... not good, as very hard to time precisely.</p>
  
  <p>Another way could be, if my app faces authentication exception, just refresh password and make a new connection and retry app logic.</p>
  
  <p>What is the industry standard?</p>