2

I have a step function that requires ARN's of lambda function. These Lambda functions are created using terraform scripts and ARN's of this are stored in the SSM parameter store. I want to retrieve these ARN's from the parameter store and pass it as input to my state machine. how do I include this in my state machine??

3 Answers3

4

AWS Step Functions integrates with AWS services like parameter store, letting you call each service's API actions from your workflow.

ref: https://docs.aws.amazon.com/step-functions/latest/dg/supported-services-awssdk.html

Here is the example of step function definition in ASL:

{
  "Comment": "This is your state machine",
  "StartAt": "GetParameter",
  "States": {
    "GetParameter": {
      "Type": "Task",
      "Parameters": {
        "Names": ["<paramter_name>"]
      },
      "Resource": "arn:aws:states:::aws-sdk:ssm:getParameters",
      "ResultSelector": {
        "ssm-parameters.$": "$.Parameters"
      },
      "End": true
    }
  }
}

Note: replace <paramter_name> with your parameter name

nirojshrestha019
  • 2,068
  • 1
  • 10
  • 14
  • If the value of your *parameter name* is encrypted, you can obtain the decrypted value by typing: `"WithDecryption": true` below `"Names": [""]` – robe007 Jul 22 '22 at 02:12
  • this works great but if your parameters have sensitive info, then the values will be visible in the SFN console – Moneer81 Mar 28 '23 at 14:13
0

I've had luck with resolving ssm params as template parameters.

In your cloudformation template.

Parameters:
  SomeTemplateVar:
    Type: String
    Default: "{{resolve:ssm:YourSSMParameter:1}}"

Then you can reference that variable in your workflow JSON.

                "Lambda Invoke": {
                  "Type": "Task",
                  "Resource": "arn:aws:states:::lambda:invoke",
                  "OutputPath": "$.Payload",
                  "Parameters": {
                    "Payload.$": "$",
                    "FunctionName": "${SomeTemplateVar}"
                  },
Evan Lalo
  • 1,209
  • 1
  • 14
  • 34
-1

There is no Step function direct service integration with Parameter Store at this moment. What you can do is to use a lambda integration which calls parameter store to fetch the data and use the result into the results path.

Pubudu Jayawardana
  • 2,250
  • 1
  • 13
  • 18