使用AWS Secrets Manager连接到AWS RD

发布于 2025-02-02 21:46:43 字数 565 浏览 4 评论 0 原文

我是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

。 谢谢你!

I'm new to AWS and I tried to use the secrets manager to connect to an RDS database. I managed to do it with spring Datasource but I want the connection to rds to be done using the DB identifier.

I don't know exactly how to do it, this is my current application.properties

#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

Can you please guide me on how I can do it?
Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

城歌 2025-02-09 21:46:43

这是一个AWS文档,可引导您了解如何在Spring Boot应用中执行此用例。在此示例用例中,使用 Aurora无服务器数据库

Furthermore, to successfully connect to the database using the

请注意,您只能将 rdsdataClient 对象用于Aurora无服务器DB群集或Aurora PostgreSQL。

要使用 rdsDataClient 对象,您需要以下两个Amazon资源名称(ARN)值:

  1. Aurora无服务器数据库的ARN。
  2. AWS Secrets Manager Secret的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:

  1. An ARN of the Aurora Serverless database.
  2. An ARN of the AWS Secrets Manager secret that is used to access the database.

To read this example use case, see:

Creating the Amazon Aurora Serverless application using the AWS SDK for Java

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文