Shows how to use the AWS SDK for Python (Boto3) with AWS Step Functions to create and run state machines.
AWS Step Functions makes it easy to coordinate the components of distributed applications as a series of steps in a visual workflow.
- Create a state machine
(
CreateStateMachine) - Delete a state machine
(
DeleteStateMachine) - Describe a state machine
(
DescribeStateMachine) - List state machine runs
(
ListExecutions) - List state machines
(
ListStateMachines) - Start a state machine run
(
StartExecution) - Stop a state machine run
(
StopExecution) - Update a state machine
(
UpdateStateMachine)
- As an AWS best practice, grant this code least privilege, or only the permissions required to perform a task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
- This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions. For more information, see the AWS Region Table on the AWS website.
- Running this code might result in charges to your AWS account.
- You must have an AWS account, and have your default credentials and AWS Region configured as described in the AWS Tools and SDKs Shared Configuration and Credentials Reference Guide.
- Python 3.7 or later
- Boto3 1.14.47 or later
- PyTest 5.3.5 or later (to run unit tests)
This example shows how to implement basic Step Functions operations. For a full example that can be run at a command prompt, see python/cross_service/stepfunctions_messenger.
The example contains the following file.
stepfunctions_basics.py
Shows how to use AWS Step Functions state machine APIs.
The unit tests in this module use the botocore Stubber. This captures requests before they are sent to AWS, and returns a mocked response. To run all of the tests, run the following in your [GitHub root]/python/example_code/stepfunctions folder.
python -m pytest
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0