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

如何传递Parameter Store参数名与值以让Step Function更新参数?

如何传递Parameter Store的参数名和值给Step Function以实现更新?

你需要通过Step Function的输入参数传递Parameter Store的参数名和值,同时修改状态机定义中的参数引用逻辑,让任务动态读取输入值来执行更新操作。

实现步骤

  1. 调整状态机定义:将PutParameter任务的Name和Value字段改为引用Step Function的输入参数,同时添加Overwrite: true(否则参数已存在时会执行失败)。
  2. 传入运行时输入:启动Step Function时,传入包含目标参数名和值的JSON结构。

完整状态机示例

{  
  "StartAt": "PutParameter",
  "States": {
    "PutParameter": {
      "Type": "Task",
      "Parameters": {
        "Name.$": "$.ParameterName",
        "Value.$": "$.ParameterValue",
        "Overwrite": true
      },
      "Resource": "arn:aws:states:::aws-sdk:ssm:putParameter",
      "End": true
    }
  }
}

运行时输入示例

启动Step Function时传入如下JSON,即可将Parameter Store中foo参数的值更新为bar:

{
  "ParameterName": "foo",
  "ParameterValue": "bar"
}

关键说明

  • 使用. $后缀(如Name.$)表示该字段的值从Step Function的输入中动态获取,$.ParameterName对应输入JSON里的ParameterName字段。
  • Overwrite: true是必填项,因为SSM的PutParameter接口默认不允许覆盖已存在的参数,添加该参数才能完成更新操作。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 07:17:37