0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【AWS】StepFunction公式ハンズオンでつまずいたところ

Last updated at Posted at 2024-12-08

これやってるので躓いたところを追記していく

03 Inputの受け取り+Choiceステートを使っていみる

ステートマシンクエリ言語の確認
ハンズオンではJSONPathで書いている

JSONPath用

{
  "TableName": "Article",
  "Key": {
    "ArticleID": {
      "S.$": "$.ArticleID"
    }
  }
}

JSONata用

{
  "TableName": "Article",
  "Key": {
    "ArticleID": {
      "S": "{% $states.input.ArticleID %}"
    }
  }
}

Choiceフロー設定

ハンズオン
image.png

自分の
image.png
image.png

コード
{
  "QueryLanguage": "JSONata",
  "Comment": "A description of my state machine",
  "StartAt": "DynamoDB GetItem",
  "States": {
    "DynamoDB GetItem": {
      "Type": "Task",
      "Resource": "arn:aws:states:::aws-sdk:dynamodb:getItem",
      "Arguments": {
        "TableName": "Article",
        "Key": {
          "ArticleID": {
            "S": "{% $states.input.ArticleID %}"
          }
        }
      },
      "Next": "Item Exist"
    },
    "Item Exist": {
      "Type": "Choice",
      "Choices": [
        {
          "Next": "成功",
          "Condition": "{% $states.input.Item != null %}"
        }
      ],
      "Default": "Fail"
    },
    "成功": {
      "Type": "Succeed"
    },
    "Fail": {
      "Type": "Fail"
    }
  },
  "TimeoutSeconds": 30
}
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?