hrynkodev
hrynkodev

Reputation: 23

How to create AWS StateMachine Activity via serverless

I'm trying to deploy Step Function, but I see no ways to define activity in serverless config. AWS docs https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-activity.html saying that activity should be defined that way, but every time I do sls deploy I can't see new activity in step function console. Is it possible at all to create activity via serverless or I have to run script/create it manually?

Resources:
MyActivity:
    Type: "AWS::StepFunctions::Activity"
    Properties:
      Name: myActivity


stepFunctions:
  stateMachines:
    stepfunctest:
      events:
        - http:
            path: step
            method: get
      definition:
        Comment: "A sample application"
        StartAt: extract
        States:
          extract:
            Type: Task
            Resource: "arn:aws:state:#{AWS::Region}:#{AWS::AccountId}:activity:MyActivity"
            End: true

Upvotes: 2

Views: 238

Answers (1)

dege
dege

Reputation: 2949

assuming you're uing the serverless plugin https://github.com/serverless-operations/serverless-step-functions. You can create the activity by adding the activity into the stepFunction

stepFuntions:
      activities:
        - myActivity
      stateMachines:
        stepfunctest:
          events:
            - http:
                path: step
                method: get
          definition:
            Comment: "A sample application"
            StartAt: extract
            States:
              extract:
                Type: Task
                Resource: "arn:aws:state:#{AWS::Region}:#{AWS::AccountId}:activity:MyActivity"
                End: true

Upvotes: 1

Related Questions