1. Packages
  2. AWS Cloud Control
  3. AWS Step Functions with the AWS Cloud Control Provider

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.5.0 published on Friday, Nov 1, 2024 by Pulumi

AWS Step Functions with the AWS Cloud Control Provider

aws-native logo

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.5.0 published on Friday, Nov 1, 2024 by Pulumi

    View Code Deploy this example with Pulumi

    A basic example that demonstrates using AWS Step Functions with a Lambda function using the AWS Cloud Control provider.

    Note: Some resources are not yet supported by the AWS Cloud Control provider, so we are also using the standard AWS provider for additional resources in this example.

    Known error

    On the first update, you may see the following error message:

    error: operation CREATE failed with "InvalidRequest": The role defined for the function cannot be assumed by Lambda. (Service: Lambda, Status Code: 400, Request ID: c33fdd39-59d4-4ba8-8ad6-29f6c04d79eb, Extended Request ID: null)
    

    Re-running the update should succeed. This issue is tracked here

    Deploying and running the program

    Note: some values in this example will be different from run to run. These values are indicated with ***.

    1. Create a new stack:

      $ pulumi stack init dev
      
    2. Set the AWS region:

      Either using an environment variable

      $ export AWS_REGION=us-west-2
      

      Or with the stack config

      $ pulumi config set aws:region us-west-2
      $ pulumi config set aws-native:region us-west-2
      
    3. Restore NPM modules via npm install or yarn install.

    4. Run pulumi up to preview and deploy changes. After the preview is shown you will be prompted if you want to continue or not.

      $ pulumi up
      Previewing update (dev)
      ...
      
      Updating (dev)
      
      View Live: https://app.pulumi.com/***/stepfunctions/dev/updates/1
      
           Type                                      Name               Status
      +   pulumi:pulumi:Stack                       stepfunctions-dev  created
      +   ├─ aws:iam:Role                           sfnRole            created
      +   ├─ aws:iam:Role                           lambdaRole         created
      +   ├─ aws:iam:RolePolicy                     sfnRolePolicy      created
      +   ├─ aws:iam:RolePolicy                     lambdaRolePolicy   created
      +   ├─ aws-native:lambda:Function             helloFunction      created
      +   ├─ aws-native:lambda:Function             worldFunction      created
      +   └─ aws-native:stepfunctions:StateMachine  stateMachine       created
      
      Outputs:
      + stateMachineArn: "arn:aws:states:us-west-2:***:stateMachine:***"
      
      Resources:
      + 10 created
      
      Duration: ***
      
    5. To see the resources that were created, run pulumi stack output:

      $ pulumi stack output
      Current stack outputs (1):
      OUTPUT           VALUE
      stateMachineArn  arn:aws:states:us-west-2:***:stateMachine:***
      
    6. Start execution using the AWS CLI (or from the console at https://console.aws.amazon.com/states)

      $ aws stepfunctions start-sync-execution --state-machine-arn $(pulumi stack output stateMachineArn)
      
    7. To clean up resources, run pulumi destroy and answer the confirmation question at the prompt.

    aws-native logo

    We recommend new projects start with resources from the AWS provider.

    AWS Cloud Control v1.5.0 published on Friday, Nov 1, 2024 by Pulumi