使用Java更新AWS参数存储中的参数值

发布于 2025-01-31 17:29:10 字数 558 浏览 2 评论 0原文

我在AWS System Manager(SSM)中存储了一个密钥作为值。是否可以使用AWS API更新值?

为了存储密钥,我使用以下API:

SsmClient ssmClientEUWest1 = SsmClient.builder().region(Region.EU_WEST_1).build();
ssmClientEUWest1.putParameter(PutParameterRequest.builder().value(key).name(<some constant name>).type("String").build());

当我第一次创建时,它会成功创建。但是,正如我再次称呼它的那样,它以&lt;某些常数名称&gt;是常数,因此无法创建重复的名称。

我需要更新。我将此键作为我方法的输入,我只需要在给定常数名称存储下更新商店中的密钥即可。

我尝试浏览AWS文档,但找不到解决方案。文档建议使用,但这也没有证明有用。

I have a key stored as value in aws system manager(ssm). Is it possible to update the value using aws APIs?

For storing the key I am using the following API:

SsmClient ssmClientEUWest1 = SsmClient.builder().region(Region.EU_WEST_1).build();
ssmClientEUWest1.putParameter(PutParameterRequest.builder().value(key).name(<some constant name>).type("String").build());

As I store the key the first time it does create successfully. However as I call it again, it fails as <some constant name> is constant and hence it can't create duplicate names.

What I need is to update the key. I get this key as an input to my method and I just need to update the key in the store under the given constant name store.

I tried going through aws docs but couldn't find a solution. Docs suggest to use tier but that didn't prove useful either.

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

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

发布评论

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

评论(1

今天小雨转甜 2025-02-07 17:29:10

探索更多并发现这可以通过设置oftrite(true)

PutParameterRequest.builder().value(key).name(<some constant name>).type("String").overwrite(true).build()

完成

Explored more and found out this can be done by setting overwrite(true)

So

PutParameterRequest.builder().value(key).name(<some constant name>).type("String").overwrite(true).build()

will do the job

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