You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于AWS CDK(Java)实现SSM参数增改查的方案咨询

AWS CDK(Java)场景实现咨询(无需自定义资源)

场景1:跨栈更新SSM StringListParameter

通过CDK栈上传包含两个值的StringListParameter至SSM参数存储;另一CDK栈获取该参数,添加新值后重新存入SSM。示例代码如下:

new StringListParameter(this, "some-id", StringListParameterProps.builder()
                .parameterName("/some/path/name")
                .stringListValue(List.of("value A", "value B"))
                .build());
IStringListParameter param = StringListParameter.fromStringListParameterName(this, "some-other-id", "/some/path/name");
List<String> stringListValue = param.getStringListValue();
stringListValue.add("value C");

场景2:跨栈获取SSM基础路径下的所有参数

创建一批共享基础路径的SSM参数;另一CDK栈获取该基础路径下的所有参数。示例代码如下:

new StringParameter(this, "some-id-a", StringParameterProps.builder()
                .parameterName("/some/name/a")
                .stringValue("value A")
                .build());

new StringParameter(this, "some-id-b", StringParameterProps.builder()
                .parameterName("/some/name/b")
                .stringValue("value B")
                .build());

补充:消费栈更新StringListParameter的可行替代方案需求

消费栈期望按以下逻辑更新StringListParameter,寻求无需自定义资源的可行替代方案:

// 从SSM导入StringListParameter
List<String> lst = StringListParameter.valueForTypedListParameter(this, "/env/service/parameter-name");

// 向StringListParameter添加新值(实现更新)
lst.add("new value");

// 将更新后的StringListParameter存入SSM
new StringListParameter(this, "some id", StringListParameterProps.builder()
    .parameterName("/dev/ca2service/cluster-consumers")
    .stringListValue(lst)
    .build());

内容的提问来源于stack exchange,提问作者Dominique M

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 04:57:03