LoginSignup
6
3

More than 5 years have passed since last update.

Serverless Step FunctionsにてLambdaの環境変数にStatemachineのARNを指定する方法

Posted at

結論

以下のようにserverless.ymlを記述することで、Lambdaの環境変数にstatemachineのARNを記述することが出来ます。

serverless.yml
functions:
  hello:
    handler: handler.hello
    environment:
        statemachine_arn: ${self:resources.Outputs.HelloStepfunc.Value}

stepFunctions:
  stateMachines:
    hellostepfunc:
      definition:
        <your definition>

resources:
  Outputs:
    HelloStepfunc:
      Description: The ARN of the example state machine
      Value:
        Ref: HellostepfuncStepFunctionsStateMachine

plugins:
  - serverless-step-functions

これでstatemachineを実行するだけのLambdaファンクションを作って、Lambdaのイベントからstatemachineを開始することが可能となります。

6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3