如何通过Spring Boot实施AWS Secret Manager?做这个的最好方式是什么?

时间:2019-08-03 08:55:47

标签: java spring-boot aws-secrets-manager

我有一个在ECS容器中运行的spring boot应用程序。我将AWS Access密钥,秘密密钥和数据库凭证存储在application.properties文件中。我需要外部化这些数据。因此,我需要实施AWS Secret Manager来存储机密。

https://medium.com/@husseinmoghnie/using-aws-secret-manager-to-secure-java-microservice-passwords-for-pci-dss-compliancy-9c35b6420e2b

我正在关注上述教程。 将凭证存储在生产环境变量中是否正确?

我将在AWS Secrets Manager中为数据库密码启用密码轮换策略。我的应用程序将如何得知临时凭证已更改?

有人可以指导我如何使用Spring Boot应用程序有效地实施AWS Secret Manager吗?最佳行业做法。

1 个答案:

答案 0 :(得分:0)

您应该使用IAM角色从ECS Task访问AWS资源。使用AWS Access Key,秘密密钥不是生产的好选择。有关在ECS任务中使用IAM角色的信息,请参考https://docs.aws.amazon.com/AmazonECS/latest/userguide/task-iam-roles.html

有关使用AWS Secret Manager进行密码轮换的信息,请参阅 https://pattern-match.com/blog/2019/06/17/springboot2-and-aws-secrets-manager/