title: How to pass JSONPath to MessageAttribute while publishing SNS message from a StepFunction?
body: <p>I am trying to pass value dynamically to MessageAttribute parameter while doing an SNS publish from a Step function.</p>
  
  <p>reference: <a href="https://docs.aws.amazon.com/step-functions/latest/dg/connect-sns.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/step-functions/latest/dg/connect-sns.html</a></p>
  
  <p>As per the example provided in the documentation if you want to publish to SNS from a Step function:</p>
  
  <pre><code>{
   "StartAt": "Publish to SNS",
   "States": {
     "Publish to SNS": {
       "Type": "Task",
       "Resource": "arn:aws:states:::sns:publish",
       "Parameters": {
         "TopicArn": "arn:aws:sns:us-east-1:111222333444:myTopic",
         "Message.$": "$.input.message",
         "MessageAttributes": {
           "my attribute no 1": {
             "DataType": "String",
             "StringValue": "value of my attribute no 1"
           },
           "my attribute no 2": {
             "DataType": "String",
             "StringValue": "value of my attribute no 2"
           }
         }
       },
       "End": true
      }
    }
  }
  </code></pre>
  
  <p>Now suppose my input to the state machine is as follows: </p>
  
  <pre><code>"SNSDetails": {
      "attribute1": "some value",
      "attribute2": "some other value",
    }
  </code></pre>
  
  <p>How can I dynamically access the $.SNSDetails.attribute1 in the "StringValue" of "my attribute no 1" and similarly access $.SNSDetails.attribute2 in the StringValue of "my attribute no 2" instead of hardcoding it? </p>
  
  <p>Ultimately I want the state machine to translate the value of "my attribute no 1" as "some value" and value of "my attribute no 2" as "some other value"</p>
  
  <p>Thanks in advance.</p>