Call Amazon SNS with Step Functions
Step Functions can control certain AWS services directly from the Amazon States Language. For more information, see the following:
Supported Amazon SNS APIs:
There is a quota for the maximum input or result data size for a task in Step Functions. This restricts you to 262,144 bytes of data as a UTF-8 encoded string when you send to, or receive data from, another service. See Quotas Related to State Machine Executions.
-
-
Supported Parameters
The following includes a Task
state that publishes to an Amazon Simple Notification Service
(Amazon SNS) topic.
{
"StartAt": "Publish to SNS",
"States": {
"Publish to SNS": {
"Type": "Task",
"Resource": "arn:aws:states:::sns:publish",
"Parameters": {
"TopicArn": "arn:aws:sns:us-east-1:123456789012: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
}
}
}
The following includes a Task
state that publishes to an Amazon SNS topic, and
then waits for the task token to be returned. See Wait for a Callback with the Task Token.
{
"StartAt":"Send message to SNS",
"States":{
"Send message to SNS":{
"Type":"Task",
"Resource":"arn:aws:states:::sns:publish.waitForTaskToken",
"Parameters":{
"TopicArn":"arn:aws:sns:us-east-1:123456789012:myTopic",
"Message":{
"Input.$":"$",
"TaskToken.$":"$$.Task.Token"
}
},
"End":true
}
}
}
For information on how to configure IAM when using Step Functions with other AWS services, see IAM Policies for Integrated Services.