{
  "Comment": "A description of my state machine",
  "StartAt": "DynamoDB GetItem",
  "States": {
    "DynamoDB GetItem": {
      "Type": "Task",
      "Resource": "arn:aws:states:::dynamodb:getItem",
      "Arguments": {
        "TableName": "feed_amount",
        "Key": {
          "id": {
            "S": "feed_amount"
          }
        }
      },
      "Next": "Choice",
      "Output": {
        "dbAmount": "{% $number($states.result.Item.feed_amount.N) %}"
      }
    },
    "Choice": {
      "Type": "Choice",
      "Choices": [
        {
          "Next": "Update FeedAmount",
          "Condition": "{% $states.input.dbAmount < 50 %}"
        }
      ]
    },
    "Update FeedAmount": {
      "Type": "Task",
      "Resource": "arn:aws:states:::dynamodb:updateItem",
      "Arguments": {
        "TableName": "feed_amount",
        "Key": {
          "id": {
            "S": "feed_amount"
          }
        },
        "UpdateExpression": "SET amount = :amountRef",
        "ExpressionAttributeValues": {
          ":amountRef": {
            "N": "300"
          }
        }
      },
      "End": true
    }
  },
  "QueryLanguage": "JSONata"
}