この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。
はじめに
好物はインフラとフロントエンドのかじわらゆたかです。
以前自分の記事で紹介した以下の件ですが、この件が解消できるオプションがリリースされたのでそのご紹介です。
Serverless Framework + StepFunctionsの構成でStateMachineを60個以上作ろうとしたらエラーになったので、暫定対応しました。
.@yutaka_1119 さんがくれた以下の記事の問題を解決するためのプルリクをマージして新しいバージョンをリリースしました!Great job and you are our hero.https://t.co/2TP2Vsc7PL
— horike takahiro (@horike37) April 8, 2020
Release v2.18.0 · serverless-operations/serverless-step-functions
noOutput オプション
当該のオプションはserverless-step-functions プラグインのバージョンが 2.18.0
でリリースされた機能になります。
そのため、使っているバージョンが上記に満たない場合は更新が必要です。
このオプションはStatemachineを定義する箇所に付与することでCloudformationへの出力を抑制することができるオプションになります。
使い方としては README にも書いてあるとおりですが、以下のようになります。
stepFUnctions:
noOutput: true
動作確認をしてみる
前回のエントリで失敗したYaml定義に noOutput
オプションを付与して実行をしてみます。
service: serverless-many-statemachine
provider:
name: aws
runtime: nodejs12.x
region: ap-northeast-1
plugins:
- serverless-step-functions
stepFunctions:
noOutput: true
stateMachines:
StateMachine1:
name: TestStateMachine1
definition:
StartAt: HelloWorld
States:
HelloWorld:
Type: Succeed
StateMachine2:
name: TestStateMachine2
definition:
StartAt: HelloWorld
States:
HelloWorld:
Type: Succeed
中略
StateMachine59:
name: TestStateMachine59
definition:
StartAt: HelloWorld
States:
HelloWorld:
Type: Succeed
StateMachine60:
name: TestStateMachine60
definition:
StartAt: HelloWorld
States:
HelloWorld:
Type: Succeed
今回はオプションのおかげで問題なくデプロイができることになります。
$ sls deploy --aws-profile cm-di-div
Serverless: Packaging service...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
........
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.........................................................................................................................................................................................................................................................................................................................................................................
Serverless: Stack update finished...
Service Information
service: serverless-many-statemachine
stage: dev
region: ap-northeast-1
stack: serverless-many-statemachine-dev
resources: 100
api keys:
None
endpoints:
None
functions:
None
layers:
None
Serverless: Run the "serverless" command to setup monitoring, troubleshooting and testing.
謝辞
今回このオプションのプルリクエストを出すにあたって、プラグインの作者である堀家様にご協力いただきました。 こちら心より感謝申し上げます。