Reputation: 381
I have a spring boot application hosted in AWS EKS using the AWS Oracle RDS.
What is the best way to use it in the spring boot application
Any links or industry standards will be appreciated.
Upvotes: 2
Views: 62
Reputation: 16
Best Practices
Assign an IAM role to your EKS pod to grant access to AWS Secrets Manager. This avoids hardcoding AWS credentials in your application.
Use AWS Secrets Manager's automatic rotation feature to ensure credentials are regularly updated.
If your application is already running on Kubernetes, the CSI Driver approach is more Kubernetes-native and integrates well with the ecosystem.
Ensure secrets are encrypted at rest and in transit.Use Kubernetes RBAC to restrict access to secrets.
Use AWS CloudTrail and Kubernetes audit logs to monitor access to secrets.
Upvotes: 0
Reputation: 1433
Best practice is to load the secrets on application startup (or some periodic refresh) from AWS Secrets Manager.
If you know the secret names beforehand, you can hardcode them in the Spring Boot application. If you're letting Secrets Manager generate the secret name automatically, you'll need to pass in the secret name as an environment variable to your Spring Boot application. This can be easily achieved if you're using IaC.
Here is a good tutorial on setting up the secrets access layer in Spring Boot using AWS Secrets Manager https://www.baeldung.com/spring-boot-integrate-aws-secrets-manager
Please note that your EKS cluster IAM role needs permission to retrieve the secrets. More information on that can be found here https://docs.aws.amazon.com/mediaconnect/latest/ug/iam-policy-examples-asm-secrets.html
Upvotes: 2