Issue
I'm on Spring boot and this is scenario:-
When I update (or rotate) my secrets, how does aws secret manager notify the
application that is using the secrets? I know I can fetch secret as done href="https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/manage-credentials-using-aws-secrets-manager.html" rel="nofollow noreferrer">here.
I know if we use aws's own JDBC, then it notifies the app, don't know
how it does internally.
My goal is, how to notify , and make the app use the latest secrets, when I'm not
using aws's JDBC (that is, without using aws-secretsmanager-jdbc)
I want to use connection pooling, without messing up with JDBC (and c3b0), for which I would just refresh context and rebuild my mysql jpa config object (connection object) with latest secrets.
Solution
At no point does SecretsManager do anything to "notify" your app. The Amazon JDBC driver just does a few things for you:
- Looks up the secret password value and caches it in memory
- Catches an authentication acceptation and tries to check for a new secret in SecretsManager when that happens
You would simply have to perform the same logic in your code if you don't want to use the AWS JDBC driver. Note that the AWS JDBC driver is just a wrapper around another JDBC driver, so the AWS JDBC driver would still be using your current JDBC driver to make the actual database connections.
Answered By - Mark B
Answer Checked By - David Marino (JavaFixing Volunteer)