AWS Step Functions
Developer Guide

Task Timer


This sample project implements an Lambda function to send an Amazon SNS notification. You can also send an Amazon SNS notification directly from the Amazon States Language. See, AWS Service Integrations.

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

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

To create the Task Timer state machine and provision all resources:

  1. Log in to the Step Functions console, and choose Create a state machine.

  2. Select Sample Projects and choose Task Timer.

    The state machine Code and Visual Workflow are displayed.

    Task timer visual workflow.


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

  3. Choose Create Sample Project.

    The Create Project Resources window 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


    It can take up to 10 minutes as these resources and related IAM permissions are created. While the Create Project Resources window displays Creating resources, you can open the Stack ID: link to see which resources are being provisioned.

    Once complete, the New execution window is displayed, with example input similar to this:

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

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

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

  6. To view the changing status of your AWS Batch job and the looping results of your execution, choose Output.

    Task timer execution output.