小编Cha*_*nis的帖子

在 AWS Step Functions 中,如何将整数输入传递给 DynamoDB

我有一个 AWS Step 函数,我需要将项目插入 DynamoDB。我将以下输入传递给 Step Function 执行:

{
   "uuid": "dd10a857-3711-451e-91ee-d0b3ab621b2e",
   "item_id": "0D98C2F77",
   "item_count": 3,
   "order_id": "IO-98255AX"
}
Run Code Online (Sandbox Code Playgroud)

我有一个 DynamoDB PutItem Step,设置如下: 除了 item_count 之外,所有属性都是字符串

由于item_count是一个数值,我指定"N.$": "$.item_count"- 我N在开头指定,因为它映射到 DynamoDB 中的数字类型。由于所有其他字段都是字符串,因此我以 开始它们的键S

然后,我尝试使用上述有效负载测试 PutItem 步骤,但出现以下错误:

{
  "error": "States.Runtime",
  "cause": "An error occurred while executing the state 'DynamoDB PutItem' (entered at the event id #2). The Parameters '{\"TableName\":\"test_item_table\",\"Item\":{\"uuid\":{\"S\":\"dd10a857-3711-451e-91ee-d0b3ab621b2e\"},\"item_id\":{\"S\":\"0D98C2F77\"},\"item_count\":{\"N\":3},\"order_id\":{\"S\":\"IO-98255AX\"}}}' could not be used to start the Task: [The value for the field 'N' must be a …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-dynamodb aws-step-functions

7
推荐指数
1
解决办法
3495
查看次数