Accessing input to step function to then use as message for SNS

365 Views Asked by At

I'm using the serverless framework to build a step function which receives input and then uses this input to send a message via SNS.

How do I pass the input to the message field?

Here is my definition and attempt:

stepFunctions:
  stateMachines:
    hellostepfunc1:
      name: testermachine
      definition:
        Comment: "test machine"
        StartAt: SNSState
        States:
          SNSState:
            Type: Task
            InputPath: $
            Resource: arn:aws:states:::sns:publish
            Parameters:
              TopicArn:
                Fn::GetAtt: [ MyTopic, TopicArn ]
              Message: {InputPath: $}
            End: true
1

There are 1 best solutions below

2
fucalost On BEST ANSWER

You can perform a SNS publish operation within a Step Function. See AWS Docs - Connect to SNS from Step Functions