Task Timer (Lambda, Amazon SNS) - Amazon Step Functions
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Task Timer (Lambda, Amazon SNS)

This sample project creates a task timer. It implements an Amazon Step Functions state machine that implements a Wait state, and uses an Amazon Lambda function that sends an Amazon Simple Notification Service (Amazon SNS) notification. A Wait state is a state type that waits for a trigger to perform a single unit of work.


This sample project implements an Amazon Lambda function to send an Amazon Simple Notification Service (Amazon SNS) notification. You can also send an Amazon SNS notification directly from the Amazon States Language. See Using Amazon Step Functions with other services.

This sample project creates the state machine, a Lambda function, and an Amazon SNS topic, and configures the related Amazon Identity and Access Management (IAM) permissions. For more information about the resources that are created with the Task Timer sample project, see the following:

For more information about how Amazon Step Functions can control other Amazon services, see Using Amazon Step Functions with other services.

To create the Task Timer state machine and provision all resources
  1. Open the Step Functions console and choose Create state machine.

  2. Choose Run a sample project, and then choose Task Timer.

    The state machine Definition and Visual Workflow are displayed.

          Task timer visual workflow.

    The Definition section in this state machine references the Amazon resources that will be created for this sample project.

  3. Choose Next.

    The Deploy resources page is displayed, listing the resources that will be created. For this sample project, the resources include:

    • A SendToSNS Lambda function

    • A TaskTimerTopic Amazon SNS topic

  4. Choose Deploy resources.


    It can take up to 10 minutes for these resources and related IAM permissions to be created. While the Deploy resources page is displayed, you can open the Stack ID link to see which resources are being provisioned.

    When complete, the Start execution dialog box is displayed, with example input similar to the following.

    { "topic": "arn:aws-cn:sns:us-east-2:123456789012:StepFunctionsSample-TaskTimer-517b8680-e0ad-07cf-feee-65aa5fc63ac0-SNSTopic-96RHT77RAKTS", "message": "HelloWorld", "timer_seconds": 10 }
  5. Choose Start Execution.

    A new execution of your state machine starts, and a new page showing your running execution is displayed.

  6. (Optional) In the Execution Details section, choose Info to view the Execution Status and the Started and Closed timestamps.

  7. To view the status, input, or output of each step in your execution, select the step in the Visual workflow and review the Step details.

          Task timer execution output.