Aurora Postgresql running on an AWS RDS has a token expiry time of 15 minutes. Unlike using a username and password to authenticate, if we use a token to authenticate as shown below, the Spring cloud function that I use authenticates but to connect and run a Spring boot application that retains the connection for extended periods of time, what is the solution to retain the connection? Because the token is expiring after 15 minutes, the Database connection is lost. Is there a way to extend this time?
RdsIamAuthTokenGenerator generator = RdsIamAuthTokenGenerator.builder()
.credentials(new DefaultAWSCredentialsProviderChain()).region("us-west-1").build();
One of the potential solutions I've seen was to use actuators to periodically regenerate the token, but is there a more standard solution to this?
Running Actuator Refresh and Actuator Rebind, is actually solving the issue but I need to figure out a way to run it from the java spring boot on a scheduler basis. Looking to see if there are other more refined solutions to this.