aws / aws/aws-secretsmanager-jdbc

Allow configuration of cache TTL via properties/environment

Open
#292 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
196
Forks
87
PR merge metrics
No merged PRs in 30d

Description

Hi,

Very cool library. Would be curious if you would accept a PR for the following:

IMO, would be very useful to allow overriding the `CacheItemTTL` via properties or environment—similar to what is done for overriding the VPC region/URL.

For Spring applications, devs can start using your library w/ just 2 lines changed in application.yaml under `spring.datasource`. That's really powerful. But if I ALSO want to configure the cache TTL, it requires a completely in-code solution, with duplication of the default code/config relating to datasource registration and connection pooling. That's a much higher barrier to entry, and also comes with some risk and a maintenance burden.

Of all the properties w/in [SecretCacheConfiguration](https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets_cache-java-ref_SecretCacheConfiguration.html), the cache TTL is the most likely to be overridden. The default is only 1 hr, but likely that most DB passwords are being changed on the order of months. Each Secrets Manager fetch comes with a cost, so reducing unnecessary fetches has a financial incentive at scale—not just the desire to reduce CPU cycles and network load.

Also, this issue has come up or been mentioned a few times in the past, see #56 and #168.

Again, happy to provide a PR for this! Thanks for your time.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how SecretCacheConfiguration is created and how the VPC region/URL are overridden from properties or the environment. Check the Spring application.yaml usage described in the issue and review #56 and #168 for prior context. Done means CacheItemTTL can be overridden without duplicating datasource registration and connection-pooling configuration, with coverage for the supported configuration paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java, spring
Domain
backend, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.