https://github.com/heiwa4126/sam-stepfunctions-apigw
API Gateway経由でStep Functionsを起動するサンプル
https://github.com/heiwa4126/sam-stepfunctions-apigw
aws-sam example stepfunctions
Last synced: 8 months ago
JSON representation
API Gateway経由でStep Functionsを起動するサンプル
- Host: GitHub
- URL: https://github.com/heiwa4126/sam-stepfunctions-apigw
- Owner: heiwa4126
- Created: 2022-04-05T06:16:46.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-05T07:00:33.000Z (about 4 years ago)
- Last Synced: 2025-01-04T16:18:45.990Z (over 1 year ago)
- Topics: aws-sam, example, stepfunctions
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sam-stepfunctions-apigw
API Gateway経由でStep Functionsを起動するサンプル。
# 概要
ペイロードつけて/runを呼ぶと
Step Functionsのstart-executionが実行されて
executionArnが返ってくる。
Step Functionsはわざとlambda実行後10秒待つように書いてある。
executionArnを引数に/resultを時々呼ぶと
lambdaでdescribe-executionが実行されてて、
結果がSUCCEEDEDなら答えが得られる。
これは簡易的なもの。
1000個程度のトランザクションはStep Functionsに保持されるらしい。
それ以上残したい場合はDynamoDBに入れる(TODO)
# デプロイ
```sh
sam build
sam deploy --guided # --guidedは最初の1回
```
`sam deploy --guided` は
```
XXXFunction may not have authorization defined, Is this okay? [y/N]: y
```
以外はデフォルトでいいです。
デプロイが終わったら
```sh
./export1.sh # 実行にはjqとyqとaws cliが必要
```
で、APIのURLを `.export.sh` に書き出してください。
# テストの実行
```sh
./run_test.sh # Step Functionの起動
./result_test.sh # 起動して10秒以内に呼ぶと"RUNNING"になる
sleep 10
./result_test.sh # Step Functionの結果の取得
```
# スタックの削除
```sh
sam delete --no-prompts
```
で消えます。