Load service configuration details from AWS S3

Recently, we worked on a microservice that handles many queues for retrying failed tasks, each having different configuration properties. Until we calibrate our application, we had to adjust those configuration properties almost daily and that was quite painful for us: code changes, code review, deployment and tomorrow from the beginning.

In order to make our life easier, we wrote a small Java library that read a .properties file from S3 and then, when our Spring Boot microservice starts, it loads configuration from that file. In that way, it becomes way simpler for us to adjust service parameters: simply change file in S3, then restart the application and we are done.

We thought it’s a good idea to externalize that library in Maven, maybe someone can also benefit from it. The entire code base it’s available in Github.

Also, to demo how to integrate it, we wrote a basic Spring Boot app. Feel free to clone the Github repository from here.

To test it, create a .properties file, that has default.text=blablabla entry and put it into S3.

Then start the service, as it’s described into README file:

mvn package && java -Daws.accessKey=<> -Daws.secretKey=<> -Ds3.config.bucket=<> -Ds3.config.filename=<> target/cirrus-up-cloud-demo-s3-config-files-1.0.jar

Then, call it to see a configuration property is loaded from S3:

curl http://localhost:8080/hello
Hello, blablabla!

As always, we invite you to send a message with your feedback about this library!