How can I automatically reload Spring Boot configuration from S3 without restarting the app?

0
0
Asked By TechWhiz123 On

I'm running five instances of a Spring Boot application behind a load balancer, handling around 500 transactions per second, with a read-heavy workload. The configurations are stored in an S3 bucket and are loaded locally at startup. Currently, every time I update the S3 config, I have to manually restart all instances, which isn't ideal for availability and creates operational overhead. I need a solution to automatically reload the config without restarting, preferably using AWS-native services. It should detect when the config file in S3 is updated and notify each instance to reload it while being cost-effective and scalable for my 500 TPS scenario. Are there any common patterns or best practices in AWS for achieving this, perhaps involving S3 event notifications, Lambda, or SNS/SQS?

3 Answers

Answered By KubernetesFan99 On

Have you thought about running your workload on EKS? You could manage config updates through Kubernetes methods like injecting config via CloudFormation. Just keep in mind that updating a config map might restart your pods unless you find a way to handle it differently.

SpringBootSam -

That's true, but I’m not sure if there's a method to keep the pods running without restarts when the config updates. Anyone have insights on that?

Answered By DevDude42 On

You might want to check out a Medium article that explains how to set up a URL endpoint for reloading the configuration in Spring Boot. You can configure S3 bucket notifications to trigger an SQS message or send a direct call to a Lambda function that hits that endpoint.

Answered By CloudNinja77 On

Consider using AWS Secrets Manager or Parameter Store with the Java SDK. They have caching and reloading capabilities that could simplify your setup and avoid the need to manually manage config updates.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.