amazon-web-servicesaws-step-functions

System Manager Parameter Store Input


How can I pass the name of a Parameter Store's parameter name and value so that a step function updates it?

Input: parameter-store-Parameter-Name = "foo", value = "bar". Step function runs, updates the parameter store's "foo" parameter with the value "bar"

enter image description here

{
  "StartAt": "PutParameter",
  "States": {
    "PutParameter": {
      "Type": "Task",
      "Parameters": {
        "Name": "Name-of-Parameter",
        "Value": "Value"
      },
      "Resource": "arn:aws:states:::aws-sdk:ssm:putParameter",
      "End": true
    }
  }
}

Solution

  • You execute a Step Function with a parameter in the form of JSON. If that JSON contains keys ParamKey and ParamValue like this:

    {
        "ParamKey": "foo",
        "ParamValue": "bar"
    }
    

    Then you could update your Step Function to access the Input path:

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