使用AWS Secrets Manager连接到AWS RD
我是AWS的新手,我尝试使用Secrets Manager连接到RDS数据库。我设法使用Spring DataSource进行操作,但我希望使用DB标识符完成与RDS的连接。
我不知道该怎么做,这是我当前的应用程序
#spring.datasource.url=jdbc-secretsmanager:postgresql://database-1.c5xr47tuzrvd.us-west-2.rds.amazonaws.com/postgres
#spring.datasource.driver-class-name=com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver
#spring.datasource.username=/secrets/shopping-cart/db
cloud.aws.rds.database-1.username=postgres
cloud.aws.rds.database-1.password=****
cloud.aws.rds.database-1.databaseName=postgres
。 谢谢你!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个AWS文档,可引导您了解如何在Spring Boot应用中执行此用例。在此示例用例中,使用 Aurora无服务器数据库。
Furthermore, to successfully connect to the database using the
请注意,您只能将 rdsdataClient 对象用于Aurora无服务器DB群集或Aurora PostgreSQL。
要使用 rdsDataClient 对象,您需要以下两个Amazon资源名称(ARN)值:
要读取此示例用例,请参见:
Here is an AWS Doc that walks you through how to perform this use case in a Spring Boot app. In this example use case, an Aurora Serverless database is used.
Furthermore, to successfully connect to the database using the RdsDataClient object (which is part of the AWS SDK for Java V2), you have to set up an AWS Secrets Manager secret that is used for authentication. This doc shows you how to hook this value into the Java logic as well.
Note that you can only use the RdsDataClient object for an Aurora Serverless DB cluster or an Aurora PostgreSQL.
To use the RdsDataClient object, you require the following two Amazon Resource Name (ARN) values:
To read this example use case, see:
Creating the Amazon Aurora Serverless application using the AWS SDK for Java