Slide 1

Slide 1 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. re:Invent reCap AWS Step Functions Update

Slide 2

Slide 2 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 3

Slide 3 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functionsとは • 弾⼒性のあるワークフローオートメーション • 組み込みのリトライ、エラーハンドリング • 200以上のAWSサービスとの強⼒な統合 • Standard Workflow、Express Workflow、 同期型Express Workflowも提供 • ビジュアル編集可能な Step Functions Workflow Studioを提供 フルマネージドなオーケストレーター

Slide 4

Slide 4 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functionsはどのように動作するか Step Functionsで構築したワークフローはステートマシンと 呼ばれ、ワークフローの個々のステップはステート(状態)と呼 ばれる ステートマシンを実⾏する時、⼀つのステートから次のステート へ移動することを状態遷移と呼ぶ コンポーネントの再利⽤が可能で、ステートを容易に編集し、 要件の変更に応じてtaskステートによってコードを交換すること が可能

Slide 5

Slide 5 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functionsとは コンソールで視覚化 JSONで定義(Amazon States Language) 実⾏結果をモニタリング

Slide 6

Slide 6 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon States Language (ASL) https://states-language.net/spec.html { "Comment": "A simple minimal example", "StartAt": "Hello World", "States": { "Hello World": { "Type": "Task", "Resource": "arn:aws:lambda...HelloWorld", "End": true }, [. . .] } }

Slide 7

Slide 7 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ステートタイプ Task タスクを実⾏ Choice 分岐ロジックを追加 Wait 遅延時間を追加 Parallel 並列に分岐を実⾏ Map ステートマシンで⼊⼒配列のアイテムを個別に処理 Succeed 成功した実⾏のシグナルと停⽌ Fail 失敗した実⾏のシグナルと停⽌ Pass ⼊⼒を出⼒にパス

Slide 8

Slide 8 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Step Functions が YAML のツールサポートを追加 • ⼀部ツールにおいてステートマシンの定義に YAML を使えるように • AWS Toolkit for Visual Studio Code, AWS CloudFormation でサポート AWS Toolkit for Visual Studio Code AWS CloudFormation JSON YAML

Slide 9

Slide 9 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS CDK Step Functions コンストラクトの利⽤ CDK V1の場合︓ • @aws-cdk/aws-stepfunctions パッ ケージは、ワークフローを構築する ためのコンストラクト • @aws-cdk/aws-stepfunctions- tasksパッケージは、他のAWSサービ スを呼び出すために使⽤されるクラ ス CDK V2の場合︓ • aws-cdk-lib/aws_stepfunctions_tasks • aws-cdk-lib/aws_stepfunctions (snip) const getStatus = new tasks.LambdaInvoke(this, 'Get Job Status', { lambdaFunction: getStatusLambda, // Pass just the field named "guid" into the Lambda, put the // Lambda's result in a field called "status" in the response inputPath: '$.guid', outputPath: '$.Payload', }); const definition = submitJob .next(waitX) .next(getStatus) .next(new sfn.Choice(this, 'Job Complete?') // Look at the "status" field .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus) .otherwise(waitX)); new sfn.StateMachine(this, 'StateMachine', { definition, timeout: Duration.minutes(5), });

Slide 10

Slide 10 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functions Data Science SDK による ワークフローの構築 AWS Step Functions Data Science SDK : Pythonで前処理 - 学習 - デプロイ のワークフローを構築 https://aws.amazon.com/jp/about-aws/whats-new/2019/11/introducing-aws-step-functions-data-science-sdk-amazon-sagemaker/ https://github.com/aws/amazon-sagemaker-examples/

Slide 11

Slide 11 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Slide 12

Slide 12 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Step Functions Workflow Studio による ワークフローの構築 Workflow Studio は、ビジュアルツールを 使⽤してワークフローをより迅速に開発 https://aws.amazon.com/jp/blogs/news/new-aws-step-functions-workflow-studio-a-low-code-visual-tool-for-building-state-machines/ Data Science Amazon SageMaker Amazon EMR Amazon Athena Amazon Glue

Slide 13

Slide 13 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functions Workflow Studioデモ • AWS Step Functionsの同期型Express Workflowを作成し、 ワークフローをAPI Gatewayから直接呼び出す。ワークフローの中か らDynamoDBへの書き込みを⾏うデモ • デモの構築⼿順 • Amazon DynamoDBのテーブルを作成 • Workflow Studioで同期型Express Workflowを作成 • AWS Step Functionsでテストを実⾏ • Amazon API GatewayからWorkflowを起動する設定を実施

Slide 14

Slide 14 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Step Functions Data flow simulator 各Stateは、JSONを受け取り、 出⼒としてJSONを次の状態に渡す • データが状態から状態へと、 どのように流れるかの理解が 容易に • データをフィルタリングおよび 操作する⽅法を学べる

Slide 15

Slide 15 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functionsの同期Express Workflowが PrivateLinkをサポート • ⼀般利⽤を開始 • パブリックなインターネット回線を利⽤せずにPrivateLinkを通じてVPC内から 同期Express Worklowを実⾏可能 • PrivateLink経由でStep Functions内からAWS SDK統合を利⽤して200以上の AWSサービスを実⾏可能 • Standerd Workflowと⾮同期Express Workflowも利⽤可能

Slide 16

Slide 16 text

© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Step FunctionsのPrivateLinkサポート AWS Cloud AWS Direct Connect AWS Site-to-Site VPN Corporate data center VPC Private subnet virtual gateway VPC Endpoints AWS PrivateLink AWS Step Functions AWS Lambda Amazon DynamoDB

Slide 17

Slide 17 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step FunctionsがAthenaのコンソールと統合 • ⼀般利⽤を開始 • AthenaのコンソールからStep Functions のワークフローを管理 • Athenaに組み込まれたワークフローの インタラクティブなダイアグラムのビュー • AthenaとStep Functionsを分散データ 処理パイプラインとして使⽤可能。 Athenaでデータ処理しStep Functionsで ワークフローをオーケストレーション • AWS Batchコンソールとも同様に統合

Slide 18

Slide 18 text

© 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 関連情報 • AWS Step Functions の Synchronous Express Workflow が AWS PrivateLink のサポートを開始 https://aws.amazon.com/jp/about-aws/whats-new/2021/11/aws-step- functions-synchronous-express-aws-private-link/ • Amazon Athena が AWS Step Functions のワークフローを可視化するコンソー ルサポートを追加 https://aws.amazon.com/jp/about-aws/whats-new/2021/11/amazon- athena-console-step-functions-workflows/

Slide 19

Slide 19 text

Thank you! © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.