Skip to main content

Search the Dev Center

Search tutorials, templates, examples, and more.

AWS Step Functions

Basic example of AWS Step Functions in Python

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set aws-py-stepfunctions
cd pulumi-examples/aws-py-stepfunctions

A basic example that demonstrates using AWS Step Functions with a Lambda function, written in Python.

Prerequisites#

  1. Install Pulumi
  2. Configure AWS credentials
  3. Install Python

Deploying the example#

  1. Create a new stack:

    Terminal window
    pulumi stack init stepfunctions-dev
  2. Set the AWS region to deploy into:

    Terminal window
    pulumi config set aws:region us-east-2
  3. Install dependencies:

    Terminal window
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  4. Deploy the stack:

    Terminal window
    pulumi up
  5. Start an execution using the AWS CLI (or from the console at https://console.aws.amazon.com/states):

    Terminal window
    aws stepfunctions start-execution --state-machine-arn $(pulumi stack output state_machine_arn)

Cleaning up#

Once you’re finished experimenting, destroy your stack and remove it to avoid incurring any additional cost:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.